Documentation ¶
Index ¶
- func Debug(msg string, fields ...Field)
- func Debugf(format string, v ...any)
- func Debugw(msg string, keysAndValues ...any)
- func Error(msg string, fields ...Field)
- func Errorf(format string, v ...any)
- func Errorw(msg string, keysAndValues ...any)
- func Fatal(msg string, fields ...Field)
- func Fatalf(format string, v ...any)
- func Fatalw(msg string, keysAndValues ...any)
- func Flush()
- func Info(msg string, fields ...Field)
- func Infof(format string, v ...any)
- func Infow(msg string, keysAndValues ...any)
- func Init(opts *Options)
- func New(opts *Options) *logger
- func Panic(msg string, fields ...Field)
- func Panicf(format string, v ...any)
- func Panicw(msg string, keysAndValues ...any)
- func Warn(msg string, fields ...Field)
- func Warnf(format string, v ...any)
- func Warnw(msg string, keysAndValues ...any)
- func WithContext(ctx context.Context) context.Context
- type Field
- type Logger
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger interface { // Output info log Info(msg string, fields ...Field) Infof(fromat string, v ...any) Infow(msg string, keysAndValues ...any) // Output debug log Debug(msg string, fields ...Field) Debugf(fromat string, v ...any) Debugw(msg string, keysAndValues ...any) // Output warning log Warn(msg string, fields ...Field) Warnf(format string, v ...any) Warnw(msg string, keysAndValues ...any) // Output error log Error(msg string, fields ...Field) Errorf(format string, v ...any) Errorw(msg string, keysAndValues ...any) // Output panic log Panic(msg string, fields ...Field) Panicf(format string, v ...any) Panicw(msg string, keysAndValues ...any) // Output fatal log Fatal(msg string, fields ...Field) Fatalf(format string, v ...any) Fatalw(msg string, keysAndValues ...any) // Fulsh calls the underlying ZAP Core's Sync method, flushing any buffered log // entries. Applications should take care to call Sync before exiting. Flush() // WithValues adds some key-value pairs of context to a logger. WithValues(keysAndValues ...any) Logger // WithName adds a new element to the logger's name. // Successive calls with WithName continue to append // suffixes to the logger's name. WithName(name string) Logger // WithContext returns a copy of context in which the log value is set. WithContext(ctx context.Context) context.Context }
Logger defines the capabilities that a logger has.
func FromContext ¶
FromContext returns the value of the log key on the ctx.
func WithValues ¶
type Options ¶
type Options struct { OutputPaths []string `json:"log-output-paths" mapstructure:"log-output-paths"` ErrorOutputPaths []string `json:"log-error-output-paths" mapstructure:"log-error-output-paths"` Level string `json:"log-level" mapstructure:"log-level"` Format string `json:"log-format" mapstructure:"log-format"` DisableCaller bool `json:"log-disable-caller" mapstructure:"log-disable-caller"` DisableStacktrace bool `json:"log-disable-stacktrace" mapstructure:"log-disable-stacktrace"` Development bool `json:"log-development" mapstructure:"log-development"` Name string `json:"log-name" mapstructure:"log-name"` }
Options contains configuration items related to log.
func NewOptions ¶
func NewOptions() *Options
NewOptions creates an Options object with default parameters.
Click to show internal directories.
Click to hide internal directories.