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
/
doc.go
43 lines (43 loc) · 1.58 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// 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:
//
// package main
//
// import (
// "go.uber.org/zap"
// "golang.org/x/exp/slog"
//
// "github.com/nikoksr/onelog"
// slogadapter "github.com/nikoksr/onelog/adapter/slog"
// zapadapter "github.com/nikoksr/onelog/adapter/zap"
// )
//
// type superheroTracker struct {
// logger onelog.Logger
// }
//
// func main() {
// // Let's use zap's development logger as our superhero event logger
// logger, _ := zap.NewDevelopment()
//
// heroes := &superheroTracker{
// logger: zapadapter.NewAdapter(logger),
// }
//
// // Now let's log a superhero event
// heroes.logger.Info().Msg("Superman spotted in New York!")
//
// // Or perhaps we'd rather use slog for logging our superhero sightings
// heroes.logger = slogadapter.NewAdapter(slog.Default())
//
// // And now we can log another sighting
// heroes.logger.Info().Msg("Wonder Woman seen flying over Paris!")
// }
package onelog