Documentation ¶
Overview ¶
Package log provides a global logger for zerolog.
Index ¶
- Constants
- func Ctx(ctx context.Context) *zerolog.Logger
- func Debug() *zerolog.Event
- func Err(err error) *zerolog.Event
- func Error() *zerolog.Event
- func Fatal() *zerolog.Event
- func Hook(h zerolog.Hook) zerolog.Logger
- func Info() *zerolog.Event
- func Init(stage string, cfg Config, serviceAlias string, serviceVersion string, ...) (err error)
- func Level(level zerolog.Level) zerolog.Logger
- func LevelString(lvl string) zerolog.Logger
- func Log() *zerolog.Event
- func Output(w io.Writer) zerolog.Logger
- func Panic() *zerolog.Event
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Sample(s zerolog.Sampler) zerolog.Logger
- func Trace() *zerolog.Event
- func Warn() *zerolog.Event
- func With() zerolog.Context
- func WithCtx(ctx context.Context) *zerolog.Logger
- func WithLevel(level zerolog.Level) *zerolog.Event
- type CallerConfig
- type Config
- type FHLogger
- type Format
- type NSQLogger
- type SentryConfig
- type ZLogger
Constants ¶
const ( FormatText = "text" FormatJSON = "json" )
Variables ¶
This section is empty.
Functions ¶
func Ctx ¶
Ctx returns the logger associated with the ctx. If no logger is associated, a disabled logger is returned.
func Debug ¶
Debug starts a new message with debug level.
You must call Msg on the returned event in order to send the event.
func Err ¶
Err starts a new message with error level with err as a field if not nil or with info level if err is nil.
You must call Msg on the returned event in order to send the event.
func Error ¶
Error starts a new message with error level.
You must call Msg on the returned event in order to send the event.
func Fatal ¶
Fatal starts a new message with fatal level. The os.Exit(1) function is called by the Msg method.
You must call Msg on the returned event in order to send the event.
func Info ¶
Info starts a new message with info level.
You must call Msg on the returned event in order to send the event.
func Init ¶
func Init(stage string, cfg Config, serviceAlias string, serviceVersion string, w io.Writer) (err error)
set global Zerolog logger.
func LevelString ¶ added in v2.0.2
LevelString creates a child logger with the minimum accepted level set to level passed as string.
func Log ¶
Log starts a new message with no level. Setting zerolog.GlobalLevel to zerolog.Disabled will still disable events produced by this method.
You must call Msg on the returned event in order to send the event.
func Panic ¶
Panic starts a new message with panic level. The message is also sent to the panic function.
You must call Msg on the returned event in order to send the event.
func Print ¶
func Print(v ...interface{})
Print sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Print.
func Printf ¶
func Printf(format string, v ...interface{})
Printf sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Printf.
func Trace ¶
Trace starts a new message with trace level.
You must call Msg on the returned event in order to send the event.
func Warn ¶
Warn starts a new message with warn level.
You must call Msg on the returned event in order to send the event.
Types ¶
type CallerConfig ¶ added in v2.0.3
type Config ¶
type Config struct { Level string `yaml:"level"` Format Format `yaml:"format"` NoColor bool `yaml:"no_color"` Caller *CallerConfig `yaml:"caller"` Sentry *SentryConfig `yaml:"sentry,omitempty"` }
type NSQLogger ¶ added in v2.0.2
type NSQLogger struct {
// contains filtered or unexported fields
}