Documentation
¶
Overview ¶
Package logg provides a simple, thread-safe logging wrapper for zerolog with dynamic redirection support.
It allows for global initialization of logging levels and output destinations, which can be changed at runtime even for loggers that have already been created. It also encourages structured logging by providing package and component context through the Ctx function.
Index ¶
- Variables
- func Ctx(pkg string, component string) zerolog.Logger
- func Init(level string)
- func InitConsole(level string)
- func InitWithWriter(level string, w io.Writer)
- func InitWithWriters(level string, writers ...io.Writer)
- func SetKeys(pkg string, component string, event string, result string)
- func SetSilent(silent bool)
Constants ¶
This section is empty.
Variables ¶
var ( KeyPkg = "pkg" KeyComponent = "component" KeyEvent = "event" KeyResult = "result" )
Functions ¶
func Ctx ¶
Ctx returns a zerolog.Logger pre-configured with package and component context. This preserves the full zerolog API while ensuring structured metadata is always present.
func Init ¶
func Init(level string)
Init initializes the logger with the specified level and logs to os.Stderr.
func InitConsole ¶
func InitConsole(level string)
InitConsole initializes the logger with a ConsoleWriter for pretty-printed, colored output.
func InitWithWriter ¶
InitWithWriter initializes the logger with the specified level and output writer.
func InitWithWriters ¶
InitWithWriters initializes the logger with the specified level and multiple output writers.
Types ¶
This section is empty.