Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel = "debug" // InfoLevel is the default logging priority. InfoLevel = "info" // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel = "warn" // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel = "error" // FatalLevel logs a message, then calls os.Exit(1). FatalLevel = "fatal" )
View Source
const ( // InstanceZapLogger will be used to create Zap instance for the logger InstanceZapLogger int = iota // InstanceLogrusLogger will be used to create Logrus instance for the logger InstanceLogrusLogger )
Variables ¶
This section is empty.
Functions ¶
func GetConcreteLogger ¶
func GetConcreteLogger(log Logger) interface{}
GetConcreteLogger returns the underlying log instance
Types ¶
type Configuration ¶
type Configuration struct { EnableConsole bool ConsoleJSONFormat bool ConsoleLevel string // EnableFile that whether to log information to a file EnableFile bool // FileLevel is the log need json format for file FileJSONFormat bool // FileLevel is the log level that for file FileLevel string // Filename is the file to write logs to. Backup log files will be retained // in the same directory. Filename string // FileMaxSize is the maximum size in megabytes of the log file before it gets // rotated. It defaults to 100 megabytes. FileMaxSize int // FileMaxAge is the maximum number of days to retain old log files based on the // timestamp encoded in their filename. Note that a day is defined as 24 // hours and may not exactly correspond to calendar days due to daylight // savings, leap seconds, etc. The default is not to remove old log files // based on age. FileMaxAge int // Skip count for caller stack. Zap and logrus have different skip count Skip int // contains filtered or unexported fields }
Configuration stores the config for the Logger For some loggers there can only be one level across writers, for such the level of Console is picked by default
func (*Configuration) SetLevel ¶
func (c *Configuration) SetLevel(l string) error
type Fields ¶
type Fields map[string]interface{}
Fields Type to pass when we want to call WithFields for structured logging
type Logger ¶
type Logger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Panicf(format string, args ...interface{}) WithFields(keyValues Fields) Logger }
Logger is our contract for the logger
Click to show internal directories.
Click to hide internal directories.