Documentation ¶
Index ¶
- Variables
- func AddFlags(defaultConfig Config, flags *pflag.FlagSet)
- func Flags(defaultConfig Config, name string) *pflag.FlagSet
- func Get(ctx context.Context) *zap.Logger
- func New(config Config) *zap.Logger
- func With(ctx context.Context, fields ...zap.Field) context.Context
- func WithLogger(ctx context.Context, logger *zap.Logger) context.Context
- type Config
- type Format
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ Format: FormatYAML, Verbose: false, }
DefaultConfig stores handy default configuration
View Source
var EncoderConfig = zapcore.EncoderConfig{ TimeKey: "ts", LevelKey: "level", NameKey: "logger", CallerKey: "caller", FunctionKey: zapcore.OmitKey, MessageKey: "msg", StacktraceKey: "stack", LineEnding: zapcore.DefaultLineEnding, EncodeLevel: zapcore.LowercaseLevelEncoder, EncodeTime: zapcore.RFC3339NanoTimeEncoder, EncodeDuration: zapcore.SecondsDurationEncoder, EncodeCaller: zapcore.ShortCallerEncoder, }
EncoderConfig is the config of log encoder
Functions ¶
Types ¶
type Config ¶ added in v0.3.0
type Config struct { // Format defines the format of log output Format Format // Verbose turns on verbose logging Verbose bool }
Config stores configuration of the logger
func ConfigureWithCLI ¶ added in v0.3.0
ConfigureWithCLI configures logger based on CLI flags
Click to show internal directories.
Click to hide internal directories.