logkit

package
v0.0.0-...-6bc37de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithContext

func WithContext(ctx context.Context, logger *Logger) context.Context

Types

type Logger

type Logger struct {
	*zap.Logger
}

func FromContext

func FromContext(ctx context.Context) *Logger

func NewLogger

func NewLogger(conf *LoggerConfig) *Logger

func NewNopLogger

func NewNopLogger() *Logger

func (*Logger) With

func (l *Logger) With(fields ...zapcore.Field) *Logger

func (*Logger) WithContext

func (l *Logger) WithContext(ctx context.Context) context.Context

type LoggerConfig

type LoggerConfig struct {
	Level       LoggerLevel `long:"level" description:"set log level" default:"info" env:"LEVEL"`
	Development bool        `long:"development" description:"enable development mode" env:"DEVELOPMENT"`
}

type LoggerLevel

type LoggerLevel zapcore.Level

func (LoggerLevel) MarshalFlag

func (l LoggerLevel) MarshalFlag() (string, error)

func (*LoggerLevel) UnmarshalFlag

func (l *LoggerLevel) UnmarshalFlag(value string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL