Documentation ¶
Overview ¶
Package log simple logger and provides capabilities to fulfill application use cases. It supports two receivers `console` and `file` and extensible by interface and Hook.
Also provides standard logger crossover binding (drop-in replacement for standard go logger) for unified logging.
log.Info("Welcome ", "to ", "aah ", "logger") log.Infof("%v, %v, %v", "simple", "flexible", "logger") // Output: 2016-07-03 19:22:11.504 INFO Welcome to aah logger 2016-07-03 19:22:11.504 INFO simple, flexible, logger
Index ¶
- Constants
- Variables
- func AddContext(fields Fields)
- func AddHook(name string, hook HookFunc) error
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func IsLevelDebug() bool
- func IsLevelError() bool
- func IsLevelFatal() bool
- func IsLevelInfo() bool
- func IsLevelPanic() bool
- func IsLevelTrace() bool
- func IsLevelWarn() bool
- func Level() string
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Panicln(v ...interface{})
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func SetDefaultLogger(l *Logger)
- func SetLevel(level string) error
- func SetPattern(pattern string) error
- func SetWriter(w io.Writer)
- func ToGoLogger() *slog.Logger
- func Trace(v ...interface{})
- func Tracef(format string, v ...interface{})
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- func Writer() io.Writer
- type ConsoleReceiver
- type Entry
- func (e *Entry) Debug(v ...interface{})
- func (e *Entry) Debugf(format string, v ...interface{})
- func (e *Entry) Error(v ...interface{})
- func (e *Entry) Errorf(format string, v ...interface{})
- func (e *Entry) Fatal(v ...interface{})
- func (e *Entry) Fatalf(format string, v ...interface{})
- func (e *Entry) Fatalln(v ...interface{})
- func (e *Entry) Info(v ...interface{})
- func (e *Entry) Infof(format string, v ...interface{})
- func (e *Entry) IsLevelDebug() bool
- func (e *Entry) IsLevelError() bool
- func (e *Entry) IsLevelFatal() bool
- func (e *Entry) IsLevelInfo() bool
- func (e *Entry) IsLevelPanic() bool
- func (e *Entry) IsLevelTrace() bool
- func (e *Entry) IsLevelWarn() bool
- func (e *Entry) MarshalJSON() ([]byte, error)
- func (e *Entry) Panic(v ...interface{})
- func (e *Entry) Panicf(format string, v ...interface{})
- func (e *Entry) Panicln(v ...interface{})
- func (e *Entry) Print(v ...interface{})
- func (e *Entry) Printf(format string, v ...interface{})
- func (e *Entry) Println(v ...interface{})
- func (e *Entry) Reset()
- func (e *Entry) ToGoLogger() *slog.Logger
- func (e *Entry) Trace(v ...interface{})
- func (e *Entry) Tracef(format string, v ...interface{})
- func (e *Entry) Warn(v ...interface{})
- func (e *Entry) Warnf(format string, v ...interface{})
- func (e *Entry) WithField(key string, value interface{}) Loggerer
- func (e *Entry) WithFields(fields Fields) Loggerer
- type Fields
- type FileReceiver
- type FlagPart
- type HookFunc
- type Logger
- func (l *Logger) AddContext(fields Fields)
- func (l *Logger) AddHook(name string, hook HookFunc) error
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) Fatalln(v ...interface{})
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) IsLevelDebug() bool
- func (l *Logger) IsLevelError() bool
- func (l *Logger) IsLevelFatal() bool
- func (l *Logger) IsLevelInfo() bool
- func (l *Logger) IsLevelPanic() bool
- func (l *Logger) IsLevelTrace() bool
- func (l *Logger) IsLevelWarn() bool
- func (l *Logger) Level() string
- func (l *Logger) New(fields Fields) *Logger
- func (l *Logger) Panic(v ...interface{})
- func (l *Logger) Panicf(format string, v ...interface{})
- func (l *Logger) Panicln(v ...interface{})
- func (l *Logger) Print(v ...interface{})
- func (l *Logger) Printf(format string, v ...interface{})
- func (l *Logger) Println(v ...interface{})
- func (l *Logger) SetLevel(level string) error
- func (l *Logger) SetPattern(pattern string) error
- func (l *Logger) SetReceiver(receiver Receiver) error
- func (l *Logger) SetWriter(w io.Writer)
- func (l *Logger) ToGoLogger() *slog.Logger
- func (l *Logger) Trace(v ...interface{})
- func (l *Logger) Tracef(format string, v ...interface{})
- func (l *Logger) Warn(v ...interface{})
- func (l *Logger) Warnf(format string, v ...interface{})
- func (l *Logger) WithField(key string, value interface{}) Loggerer
- func (l *Logger) WithFields(fields Fields) Loggerer
- type Loggerer
- type Receiver
Constants ¶
const ( FmtFlagLevel ess.FmtFlag = iota FmtFlagAppName FmtFlagInstanceName FmtFlagRequestID FmtFlagPrincipal FmtFlagTime FmtFlagUTCTime FmtFlagLongfile FmtFlagShortfile FmtFlagLine FmtFlagMessage FmtFlagFields FmtFlagCustom FmtFlagUnknown )
Format flags used to define log message format for each log entry
const ( LevelFatal level = iota LevelPanic LevelError LevelWarn LevelInfo LevelDebug LevelTrace LevelUnknown )
Log Level definition
const Version = "0.7.1"
Version no. of aahframework.org/log library
Variables ¶
var ( // DefaultPattern is default log entry pattern in aah/log. Only applicable to // text formatter. // For e.g: // 2006-01-02 15:04:05.000 INFO This is my message DefaultPattern = "%time:2006-01-02 15:04:05.000 %level:-5 %message" // FmtFlags is the list of log format flags supported by aah log library // Usage of flag order is up to format composition. // level - outputs ERROR, WARN, INFO, DEBUG, TRACE // appname - outputs Application Name // insname - outputs Application Instance Name // reqid - outputs Request ID from HTTP header // principal - outputs Logged-In subject primary principal value // time - outputs local time as per format supplied // utctime - outputs UTC time as per format supplied // longfile - outputs full file name: /a/b/c/d.go // shortfile - outputs final file name element: d.go // line - outputs file line number: L23 // message - outputs given message along supplied arguments if they present // fields - outputs field values into log entry // custom - outputs string as-is into log entry FmtFlags = map[string]ess.FmtFlag{ "level": FmtFlagLevel, "appname": FmtFlagAppName, "insname": FmtFlagInstanceName, "reqid": FmtFlagRequestID, "principal": FmtFlagPrincipal, "time": FmtFlagTime, "utctime": FmtFlagUTCTime, "longfile": FmtFlagLongfile, "shortfile": FmtFlagShortfile, "line": FmtFlagLine, "message": FmtFlagMessage, "fields": FmtFlagFields, "custom": FmtFlagCustom, } )
var ( // ErrLogReceiverIsNil returned when suppiled receiver is nil. ErrLogReceiverIsNil = errors.New("log: receiver is nil") // ErrHookFuncIsNil is returned when hook function is nil. ErrHookFuncIsNil = errors.New("log: hook func is nil") )
Functions ¶
func AddContext ¶ added in v0.7.0
func AddContext(fields Fields)
AddContext method to add context values into default logger. These context values gets logged with each log entry.
func Debug ¶
func Debug(v ...interface{})
Debug logs message as `DEBUG`. Arguments handled in the mananer of `fmt.Print`.
func Debugf ¶
func Debugf(format string, v ...interface{})
Debugf logs message as `DEBUG`. Arguments handled in the mananer of `fmt.Printf`.
func Error ¶
func Error(v ...interface{})
Error logs message as `ERROR`. Arguments handled in the mananer of `fmt.Print`.
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf logs message as `ERROR`. Arguments handled in the mananer of `fmt.Printf`.
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf logs message as `FATAL` and call to os.Exit(1).
func Fatalln ¶
func Fatalln(v ...interface{})
Fatalln logs message as `FATAL` and call to os.Exit(1).
func Info ¶
func Info(v ...interface{})
Info logs message as `INFO`. Arguments handled in the mananer of `fmt.Print`.
func Infof ¶
func Infof(format string, v ...interface{})
Infof logs message as `INFO`. Arguments handled in the mananer of `fmt.Printf`.
func IsLevelDebug ¶ added in v0.7.0
func IsLevelDebug() bool
IsLevelDebug method returns true if log level is DEBUG otherwise false.
func IsLevelError ¶ added in v0.7.0
func IsLevelError() bool
IsLevelError method returns true if log level is ERROR otherwise false.
func IsLevelFatal ¶ added in v0.7.0
func IsLevelFatal() bool
IsLevelFatal method returns true if log level is FATAL otherwise false.
func IsLevelInfo ¶ added in v0.7.0
func IsLevelInfo() bool
IsLevelInfo method returns true if log level is INFO otherwise false.
func IsLevelPanic ¶ added in v0.7.0
func IsLevelPanic() bool
IsLevelPanic method returns true if log level is PANIC otherwise false.
func IsLevelTrace ¶ added in v0.7.0
func IsLevelTrace() bool
IsLevelTrace method returns true if log level is TRACE otherwise false.
func IsLevelWarn ¶ added in v0.7.0
func IsLevelWarn() bool
IsLevelWarn method returns true if log level is WARN otherwise false.
func Panicf ¶
func Panicf(format string, v ...interface{})
Panicf logs message as `PANIC` and call to panic().
func Print ¶
func Print(v ...interface{})
Print logs message as `INFO`. Arguments handled in the mananer of `fmt.Print`.
func Printf ¶
func Printf(format string, v ...interface{})
Printf logs message as `INFO`. Arguments handled in the mananer of `fmt.Printf`.
func Println ¶
func Println(v ...interface{})
Println logs message as `INFO`. Arguments handled in the mananer of `fmt.Printf`.
func SetDefaultLogger ¶
func SetDefaultLogger(l *Logger)
SetDefaultLogger method sets the given logger instance as default logger.
func SetPattern ¶
SetPattern method sets the log format pattern for default logger.
func ToGoLogger ¶ added in v0.7.0
ToGoLogger method wraps the current log writer into Go Logger instance.
func Trace ¶
func Trace(v ...interface{})
Trace logs message as `TRACE`. Arguments handled in the mananer of `fmt.Print`.
func Tracef ¶
func Tracef(format string, v ...interface{})
Tracef logs message as `TRACE`. Arguments handled in the mananer of `fmt.Printf`.
func Warn ¶
func Warn(v ...interface{})
Warn logs message as `WARN`. Arguments handled in the mananer of `fmt.Print`.
Types ¶
type ConsoleReceiver ¶
type ConsoleReceiver struct {
// contains filtered or unexported fields
}
ConsoleReceiver writes the log entry into os.Stderr. For non-windows it writes with color.
func (*ConsoleReceiver) Init ¶
func (c *ConsoleReceiver) Init(cfg *config.Config) error
Init method initializes the console logger.
func (*ConsoleReceiver) IsCallerInfo ¶
func (c *ConsoleReceiver) IsCallerInfo() bool
IsCallerInfo method returns true if log receiver is configured with caller info otherwise false.
func (*ConsoleReceiver) Log ¶
func (c *ConsoleReceiver) Log(entry *Entry)
Log method writes the log entry into os.Stderr.
func (*ConsoleReceiver) SetPattern ¶
func (c *ConsoleReceiver) SetPattern(pattern string) error
SetPattern method initializes the logger format pattern.
func (*ConsoleReceiver) SetWriter ¶ added in v0.7.0
func (c *ConsoleReceiver) SetWriter(w io.Writer)
SetWriter method sets the given writer into console receiver.
func (*ConsoleReceiver) Writer ¶ added in v0.7.0
func (c *ConsoleReceiver) Writer() io.Writer
Writer method returns the current log writer.
type Entry ¶
type Entry struct { Level level `json:"-"` Line int `json:"line,omitempty"` AppName string `json:"app_name,omitempty"` InstanceName string `json:"instance_name,omitempty"` RequestID string `json:"request_id,omitempty"` Principal string `json:"principal,omitempty"` Message string `json:"message,omitempty"` File string `json:"file,omitempty"` Fields Fields `json:"fields,omitempty"` Time time.Time `json:"-"` // contains filtered or unexported fields }
Entry represents a log entry and contains the timestamp when the entry was created, level, etc.
func (*Entry) Debug ¶ added in v0.7.0
func (e *Entry) Debug(v ...interface{})
Debug logs message as `DEBUG`. Arguments handled in the mananer of `fmt.Print`.
func (*Entry) Debugf ¶ added in v0.7.0
Debugf logs message as `DEBUG`. Arguments handled in the mananer of `fmt.Printf`.
func (*Entry) Error ¶ added in v0.7.0
func (e *Entry) Error(v ...interface{})
Error logs message as `ERROR`. Arguments handled in the mananer of `fmt.Print`.
func (*Entry) Errorf ¶ added in v0.7.0
Errorf logs message as `ERROR`. Arguments handled in the mananer of `fmt.Printf`.
func (*Entry) Fatal ¶ added in v0.7.0
func (e *Entry) Fatal(v ...interface{})
Fatal logs message as `FATAL` and call to os.Exit(1).
func (*Entry) Fatalln ¶ added in v0.7.0
func (e *Entry) Fatalln(v ...interface{})
Fatalln logs message as `FATAL` and call to os.Exit(1).
func (*Entry) Info ¶ added in v0.7.0
func (e *Entry) Info(v ...interface{})
Info logs message as `INFO`. Arguments handled in the mananer of `fmt.Print`.
func (*Entry) Infof ¶ added in v0.7.0
Infof logs message as `INFO`. Arguments handled in the mananer of `fmt.Printf`.
func (*Entry) IsLevelDebug ¶ added in v0.7.0
IsLevelDebug method returns true if log level is DEBUG otherwise false.
func (*Entry) IsLevelError ¶ added in v0.7.0
IsLevelError method returns true if log level is ERROR otherwise false.
func (*Entry) IsLevelFatal ¶ added in v0.7.0
IsLevelFatal method returns true if log level is FATAL otherwise false.
func (*Entry) IsLevelInfo ¶ added in v0.7.0
IsLevelInfo method returns true if log level is INFO otherwise false.
func (*Entry) IsLevelPanic ¶ added in v0.7.0
IsLevelPanic method returns true if log level is PANIC otherwise false.
func (*Entry) IsLevelTrace ¶ added in v0.7.0
IsLevelTrace method returns true if log level is TRACE otherwise false.
func (*Entry) IsLevelWarn ¶ added in v0.7.0
IsLevelWarn method returns true if log level is WARN otherwise false.
func (*Entry) MarshalJSON ¶
MarshalJSON method for formating entry to JSON.
func (*Entry) Panic ¶ added in v0.7.0
func (e *Entry) Panic(v ...interface{})
Panic logs message as `PANIC` and call to panic().
func (*Entry) Panicln ¶ added in v0.7.0
func (e *Entry) Panicln(v ...interface{})
Panicln logs message as `PANIC` and call to panic().
func (*Entry) Print ¶ added in v0.7.0
func (e *Entry) Print(v ...interface{})
Print logs message as `INFO`. Arguments handled in the mananer of `fmt.Print`.
func (*Entry) Printf ¶ added in v0.7.0
Printf logs message as `INFO`. Arguments handled in the mananer of `fmt.Printf`.
func (*Entry) Println ¶ added in v0.7.0
func (e *Entry) Println(v ...interface{})
Println logs message as `INFO`. Arguments handled in the mananer of `fmt.Printf`.
func (*Entry) ToGoLogger ¶ added in v0.7.0
ToGoLogger method wraps the current log writer into Go Logger instance.
func (*Entry) Trace ¶ added in v0.7.0
func (e *Entry) Trace(v ...interface{})
Trace logs message as `TRACE`. Arguments handled in the mananer of `fmt.Print`.
func (*Entry) Tracef ¶ added in v0.7.0
Tracef logs message as `TRACE`. Arguments handled in the mananer of `fmt.Printf`.
func (*Entry) Warn ¶ added in v0.7.0
func (e *Entry) Warn(v ...interface{})
Warn logs message as `WARN`. Arguments handled in the mananer of `fmt.Print`.
func (*Entry) Warnf ¶ added in v0.7.0
Warnf logs message as `WARN`. Arguments handled in the mananer of `fmt.Printf`.
func (*Entry) WithFields ¶ added in v0.7.0
WithFields method to add multiple key-value pairs into log.
type Fields ¶ added in v0.7.0
type Fields map[string]interface{}
Fields type is used to log fields values in the logger.
type FileReceiver ¶
type FileReceiver struct {
// contains filtered or unexported fields
}
FileReceiver writes the log entry into file.
func (*FileReceiver) Init ¶
func (f *FileReceiver) Init(cfg *config.Config) error
Init method initializes the file receiver instance.
func (*FileReceiver) IsCallerInfo ¶
func (f *FileReceiver) IsCallerInfo() bool
IsCallerInfo method returns true if log receiver is configured with caller info otherwise false.
func (*FileReceiver) Log ¶
func (f *FileReceiver) Log(entry *Entry)
Log method logs the given entry values into file.
func (*FileReceiver) SetPattern ¶
func (f *FileReceiver) SetPattern(pattern string) error
SetPattern method initializes the logger format pattern.
func (*FileReceiver) SetWriter ¶ added in v0.7.0
func (f *FileReceiver) SetWriter(w io.Writer)
SetWriter method sets the given writer into file receiver.
func (*FileReceiver) Writer ¶ added in v0.7.0
func (f *FileReceiver) Writer() io.Writer
Writer method returns the current log writer.
type FlagPart ¶
FlagPart is indiviual flag details
For e.g.: part := FlagPart{ Flag: fmtFlagTime, Name: "time", Format: "2006-01-02 15:04:05.000", }
type HookFunc ¶ added in v0.7.0
type HookFunc func(e Entry)
HookFunc type is aah framework logger custom hook.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is the object which logs the given message into recevier as per deifned format flags. Logger can be used simultaneously from multiple goroutines; it guarantees to serialize access to the Receivers.
func NewWithContext ¶ added in v0.7.0
NewWithContext method creates the aah logger based on supplied `config.Config`.
func (*Logger) AddContext ¶ added in v0.7.0
AddContext method to add context values into current logger.
func (*Logger) Debug ¶
func (l *Logger) Debug(v ...interface{})
Debug logs message as `DEBUG`. Arguments handled in the mananer of `fmt.Print`.
func (*Logger) Debugf ¶
Debugf logs message as `DEBUG`. Arguments handled in the mananer of `fmt.Printf`.
func (*Logger) Error ¶
func (l *Logger) Error(v ...interface{})
Error logs message as `ERROR`. Arguments handled in the mananer of `fmt.Print`.
func (*Logger) Errorf ¶
Errorf logs message as `ERROR`. Arguments handled in the mananer of `fmt.Printf`.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(v ...interface{})
Fatal logs message as `FATAL` and call to os.Exit(1).
func (*Logger) Fatalln ¶
func (l *Logger) Fatalln(v ...interface{})
Fatalln logs message as `FATAL` and call to os.Exit(1).
func (*Logger) Info ¶
func (l *Logger) Info(v ...interface{})
Info logs message as `INFO`. Arguments handled in the mananer of `fmt.Print`.
func (*Logger) Infof ¶
Infof logs message as `INFO`. Arguments handled in the mananer of `fmt.Printf`.
func (*Logger) IsLevelDebug ¶ added in v0.7.0
IsLevelDebug method returns true if log level is DEBUG otherwise false.
func (*Logger) IsLevelError ¶ added in v0.7.0
IsLevelError method returns true if log level is ERROR otherwise false.
func (*Logger) IsLevelFatal ¶ added in v0.7.0
IsLevelFatal method returns true if log level is FATAL otherwise false.
func (*Logger) IsLevelInfo ¶ added in v0.7.0
IsLevelInfo method returns true if log level is INFO otherwise false.
func (*Logger) IsLevelPanic ¶ added in v0.7.0
IsLevelPanic method returns true if log level is PANIC otherwise false.
func (*Logger) IsLevelTrace ¶ added in v0.7.0
IsLevelTrace method returns true if log level is TRACE otherwise false.
func (*Logger) IsLevelWarn ¶ added in v0.7.0
IsLevelWarn method returns true if log level is WARN otherwise false.
func (*Logger) New ¶ added in v0.7.0
New method creates a child logger and adds structured context to it. Child logger inherits parent logger context value on creation. Fields added to the child don't affect the parent logger and vice versa. These context values gets logged with each log entry.
Also you can use method `AddContext` to context to the current logger.
func (*Logger) Panic ¶
func (l *Logger) Panic(v ...interface{})
Panic logs message as `PANIC` and call to panic().
func (*Logger) Panicln ¶
func (l *Logger) Panicln(v ...interface{})
Panicln logs message as `PANIC` and call to panic().
func (*Logger) Print ¶
func (l *Logger) Print(v ...interface{})
Print logs message as `INFO`. Arguments handled in the mananer of `fmt.Print`.
func (*Logger) Printf ¶
Printf logs message as `INFO`. Arguments handled in the mananer of `fmt.Printf`.
func (*Logger) Println ¶
func (l *Logger) Println(v ...interface{})
Println logs message as `INFO`. Arguments handled in the mananer of `fmt.Printf`.
func (*Logger) SetLevel ¶
SetLevel method sets the given logging level for the logger. For e.g.: INFO, WARN, DEBUG, etc. Case-insensitive.
func (*Logger) SetPattern ¶
SetPattern method sets the log format pattern.
func (*Logger) SetReceiver ¶
SetReceiver method sets the given receiver into logger instance.
func (*Logger) SetWriter ¶ added in v0.7.0
SetWriter method sets the given writer into logger instance.
func (*Logger) ToGoLogger ¶ added in v0.7.0
ToGoLogger method wraps the current log writer into Go Logger instance.
func (*Logger) Trace ¶
func (l *Logger) Trace(v ...interface{})
Trace logs message as `TRACE`. Arguments handled in the mananer of `fmt.Print`.
func (*Logger) Tracef ¶
Tracef logs message as `TRACE`. Arguments handled in the mananer of `fmt.Printf`.
func (*Logger) Warn ¶
func (l *Logger) Warn(v ...interface{})
Warn logs message as `WARN`. Arguments handled in the mananer of `fmt.Print`.
func (*Logger) Warnf ¶
Warnf logs message as `WARN`. Arguments handled in the mananer of `fmt.Printf`.
func (*Logger) WithFields ¶ added in v0.7.0
WithFields method to add multiple key-value pairs into log entry.
type Loggerer ¶ added in v0.7.0
type Loggerer interface { Error(v ...interface{}) Errorf(format string, v ...interface{}) Warn(v ...interface{}) Warnf(format string, v ...interface{}) Info(v ...interface{}) Infof(format string, v ...interface{}) Debug(v ...interface{}) Debugf(format string, v ...interface{}) Trace(v ...interface{}) Tracef(format string, v ...interface{}) // Context/Field methods WithFields(fields Fields) Loggerer WithField(key string, value interface{}) Loggerer // Level Info IsLevelInfo() bool IsLevelError() bool IsLevelWarn() bool IsLevelDebug() bool IsLevelTrace() bool IsLevelFatal() bool IsLevelPanic() bool // For standard logger drop-in replacement ToGoLogger() *slog.Logger Print(v ...interface{}) Printf(format string, v ...interface{}) Println(v ...interface{}) Fatal(v ...interface{}) Fatalf(format string, v ...interface{}) Fatalln(v ...interface{}) Panic(v ...interface{}) Panicf(format string, v ...interface{}) Panicln(v ...interface{}) }
Loggerer interface is for Logger and Entry log method implementation.
func WithFields ¶ added in v0.7.0
WithFields method to add multiple key-value pairs into log.