Documentation ¶
Overview ¶
Package log is a log package used by dazBlog project
Index ¶
- func C(ctx context.Context) *zapLogger
- func Debugw(msg string, keysAndValues ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func Init(opts *Options)
- func NewLogger(opts *Options) *zapLogger
- func Panicw(msg string, keysAndValues ...interface{})
- func Sync()
- func Warnw(msg string, keysAndValues ...interface{})
- type Logger
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func C ¶
C extracts relevant key-value pairs from the incoming context and adds them to the structured logs of the zap.Logger.
func NewLogger ¶
func NewLogger(opts *Options) *zapLogger
NewLogger creates a new logger with the given options
Types ¶
type Logger ¶
type Logger interface { Debugw(msg string, keysAndValues ...interface{}) Infow(msg string, keysAndValues ...interface{}) Warnw(msg string, keysAndValues ...interface{}) Errorw(msg string, keysAndValues ...interface{}) Panicw(msg string, keysAndValues ...interface{}) Fatalw(msg string, keysAndValues ...interface{}) Sync() }
Logger define dBlog's logger interface
type Options ¶
type Options struct { // if enabled, the log will display the file and line num of the calling log DisableCaller bool // if enabled, will print stack info for panic and higher log level DisableStacktrace bool // log level: debug, info , warn, error, dpanic, panic, fatal Level string // log format: console, json Format string // specify log output path OutputPaths []string }
Options the options for the logger
func NewOptions ¶
func NewOptions() *Options
NewOptions creates an Options object with default parameters
Click to show internal directories.
Click to hide internal directories.