Documentation
¶
Index ¶
- func CtxWithAttrs(ctx context.Context, fields ...zap.Field) context.Context
- func DPanic(msg string, fields ...zap.Field)
- func DPanicContext(ctx context.Context, msg string, fields ...zap.Field)
- func Debug(msg string, fields ...zap.Field)
- func DebugContext(ctx context.Context, msg string, fields ...zap.Field)
- func Error(msg string, fields ...zap.Field)
- func ErrorContext(ctx context.Context, msg string, fields ...zap.Field)
- func Fatal(msg string, fields ...zap.Field)
- func FatalContext(ctx context.Context, msg string, fields ...zap.Field)
- func GetCtxFields(ctx context.Context) []zap.Field
- func Global() *zap.Logger
- func Info(msg string, fields ...zap.Field)
- func InfoContext(ctx context.Context, msg string, fields ...zap.Field)
- func Init(level, mode string, opts ...zap.Option) error
- func NewFromConfig(cfg *Config, opts ...zap.Option) *zap.Logger
- func NewFromCtx(ctx context.Context) *zap.Logger
- func Panic(msg string, fields ...zap.Field)
- func PanicContext(ctx context.Context, msg string, fields ...zap.Field)
- func RedactDSN(dsn string) string
- func SetCtxFields(ctx context.Context, fields ...zap.Field)
- func Warn(msg string, fields ...zap.Field)
- func WarnContext(ctx context.Context, msg string, fields ...zap.Field)
- func WithCtxFields(ctx context.Context, fields ...zap.Field) []zap.Field
- func WithFields(fields ...zap.Field) *zap.Logger
- func WithOptions(opts ...zap.Option) *zap.Logger
- func WrapInCtx(ctx context.Context, logger *zap.Logger) context.Context
- type Config
- type LogMod
- type StructLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCtxFields ¶
GetCtxFields returns key+value from passed context for logger.
func Init ¶
Init validates and installs a new process-wide logger. Invalid settings leave the previously installed logger unchanged.
func NewFromConfig ¶
NewFromConfig installs a logger built from a plain-Go configuration.
It preserves the historical panic-on-invalid-config behavior; prefer Init when configuration errors must be returned to the caller.
func NewFromCtx ¶
NewFromCtx creates new logger from context.
func RedactDSN ¶
RedactDSN masks credentials in supported connection-string grammars. Inputs that cannot be classified unambiguously never appear in diagnostics.
func SetCtxFields ¶
SetCtxFields set key+value in passed context for logger.
Types ¶
type Config ¶
type Config struct {
LogMod LogMod `default:"development" mapstructure:"mod" validate:"oneof=production development"`
LogLevel string `default:"debug" mapstructure:"level" validate:"oneof=debug info warn error fatal"`
}
Config is the plain-Go logger configuration.
type StructLogger ¶
StructLogger is an alias for *zap.Logger included in project structs.
func NewStructLogger ¶
func NewStructLogger(name string) StructLogger
NewStructLogger returns a named child of the process-wide logger.