This repository has been archived by the owner on Aug 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(onelog): improve go.doc and comments
- Loading branch information
Showing
10 changed files
with
137 additions
and
41 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,40 @@ | ||
// Package onelog is a simple, versatile and performance-conscious logging interface that aims to provide a common base | ||
// for structured logging in Go. It supports adapters for multiple logging libraries, providing the flexibility to | ||
// switch between different loggers according to the requirements without changing the application’s logging interface | ||
// code. This package includes adapters for zap, zap's sugared logger, slog, and zerolog among others, supporting a | ||
// variety of logging styles and functionalities. | ||
// Package onelog is a general-purpose logging interface heavily inspired by the zerolog API. | ||
// It is designed to provide a user-friendly API for diverse logging requirements. This package | ||
// supports a wide range of data types and log levels, creating flexibility for various use cases. | ||
// | ||
// onelog includes adapters for several commonly used loggers, enabling easy integration | ||
// and compatibility with existing logging methodologies. It reduces the friction associated | ||
// with logging setup and promotes consistency in logging across different parts of a project or across different projects. | ||
// | ||
// Here is a brief example using the zapadapter and slogadapter: | ||
|
||
// import ( | ||
// "go.uber.org/zap" | ||
// "github.com/nikoksr/onelog" | ||
// "github.com/nikoksr/onelog/zapadapter" | ||
// "github.com/nikoksr/onelog/slogadapter" | ||
// ) | ||
// | ||
// type superTracker struct { | ||
// superEventLogger onelog.Logger | ||
// } | ||
// | ||
// func main() { | ||
// // Let's use zap's development logger as our superhero event logger | ||
// logger, _ := zap.NewDevelopment() | ||
// | ||
// tracker := &superTracker{ | ||
// superEventLogger: zapadapter.NewAdapter(logger), | ||
// } | ||
// | ||
// // Now let's log a superhero event | ||
// tracker.superEventLogger.Info().Msg("Superman spotted in New York!") | ||
// | ||
// // Or perhaps we'd rather use slog for logging our superhero sightings | ||
// logger := slog.Default() | ||
// tracker.superEventLogger = slogadapter.NewAdapter(logger) | ||
// | ||
// // And now we can log another sighting | ||
// tracker.superEventLogger.Info().Msg("Wonder Woman seen flying over Paris!") | ||
// } | ||
package onelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters