Documentation
¶
Index ¶
- func NewAdapter(l zerolog.Logger) *goLog.Logger
- func NewRootLogger(options LoggerOutputOptions) (zerolog.Logger, func())
- func RegisterContextProvider(p ContextProvider)
- func With(ctx context.Context, log zerolog.Logger) zerolog.Context
- type ContextProvider
- type LoggerOutputOptions
- type Service
- type TimeFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRootLogger ¶
func NewRootLogger(options LoggerOutputOptions) (zerolog.Logger, func())
NewRootLogger creates a new zerolog logger with default settings.
func RegisterContextProvider ¶
func RegisterContextProvider(p ContextProvider)
RegisterContextProvider records a given context provider. This method is supposed to be called in an `init` method.
Types ¶
type ContextProvider ¶
type LoggerOutputOptions ¶
type LoggerOutputOptions struct {
Color bool // Produce colored logs
TimeFormat TimeFormat // Instructs how to print time in logs
Stderr bool // Write logs to stderr
LogFile string // Path of file to write to
}
type Service ¶
type Service interface {
// MustGetLogger creates a logger with given name.
MustGetLogger(name string) zerolog.Logger
// MustSetLevel sets the log level for the component with given name to given level.
MustSetLevel(name, level string)
// RotateLogFiles re-opens log file writer.
RotateLogFiles()
}
Service exposes the interfaces for a logger service that supports different loggers with different levels.
func NewService ¶
func NewService(defaultLevel string, options LoggerOutputOptions) (Service, error)
NewService creates a new Service.
type TimeFormat ¶
type TimeFormat int
const ( TimeFormatLocal TimeFormat = 0 TimeFormatUTC TimeFormat = 1 )
Click to show internal directories.
Click to hide internal directories.