Documentation ¶
Overview ¶
Package logger contains logging implementations.
Index ¶
- type Logger
- type OptionLogger
- type OptionsLogger
- type ZapLogger
- func (l *ZapLogger) Debug(msg string, fields ...zap.Field)
- func (l *ZapLogger) DebugWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) Error(msg string, fields ...zap.Field)
- func (l *ZapLogger) ErrorWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) Fatal(msg string, fields ...zap.Field)
- func (l *ZapLogger) FatalWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) Info(msg string, fields ...zap.Field)
- func (l *ZapLogger) InfoWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) Panic(msg string, fields ...zap.Field)
- func (l *ZapLogger) PanicWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) Warn(msg string, fields ...zap.Field)
- func (l *ZapLogger) WarnWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) With(fields ...zap.Field)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { // These are ops that call directly to the actual zap implementation Debug(string, ...zap.Field) Info(string, ...zap.Field) Warn(string, ...zap.Field) Error(string, ...zap.Field) Panic(string, ...zap.Field) Fatal(string, ...zap.Field) // These are the equivalent logger function but with context provided DebugWithContext(context.Context, string, ...zap.Field) InfoWithContext(context.Context, string, ...zap.Field) WarnWithContext(context.Context, string, ...zap.Field) ErrorWithContext(context.Context, string, ...zap.Field) PanicWithContext(context.Context, string, ...zap.Field) FatalWithContext(context.Context, string, ...zap.Field) }
type OptionLogger ¶ added in v1.5.1
type OptionLogger func(ol *OptionsLogger)
func WithFormat ¶ added in v1.5.1
func WithFormat(format string) OptionLogger
func WithLevel ¶ added in v1.5.1
func WithLevel(level string) OptionLogger
func WithOutputPaths ¶ added in v1.6.0
func WithOutputPaths(paths ...string) OptionLogger
WithOutputPaths sets a list of URLs or file paths to write logging output to.
URLs with the "file" scheme must use absolute paths on the local filesystem. No user, password, port, fragments, or query parameters are allowed, and the hostname must be empty or "localhost".
Since it's common to write logs to the local filesystem, URLs without a scheme (e.g., "/var/log/foo.log") are treated as local file paths. Without a scheme, the special paths "stdout" and "stderr" are interpreted as os.Stdout and os.Stderr. When specified without a scheme, relative file paths also work.
Defaults to "stdout".
func WithTimestampFormat ¶ added in v1.5.1
func WithTimestampFormat(timestampFormat string) OptionLogger
type OptionsLogger ¶ added in v1.5.1
type OptionsLogger struct {
// contains filtered or unexported fields
}
OptionsLogger Implements options for logger.
type ZapLogger ¶
ZapLogger is an implementation of Logger that uses the uber/zap logger underneath. It provides additional methods such as ones that logs based on context.
func MustNewLogger ¶ added in v0.3.1
func NewLogger ¶ added in v0.3.1
func NewLogger(options ...OptionLogger) (*ZapLogger, error)