Documentation
¶
Index ¶
Constants ¶
View Source
const ( TraceLevelString = "trace" DebugLevelString = "debug" InfoLevelString = "info" WarnLevelString = "warn" ErrorLevelString = "error" FatalLevelString = "fatal" )
Log level
View Source
const DefaultTimeFormat = time.RFC3339
DefaultTimeFormat of logger
Variables ¶
This section is empty.
Functions ¶
func LevelToString ¶
LevelToString convert log level to readable string
Types ¶
type Config ¶
type Config struct {
Level Level
AppName string
LogFile string
TimeFormat string
CallerSkip int
Caller bool
UseColor bool
UseJSON bool
StdLog bool
Debug bool
}
Config of logger
type KV ¶
type KV = map[string]interface{}
KV is a type for logging with more information this used by ...WithFields function
type Logger ¶
type Logger interface {
SetLevel(level Level)
Debug(args ...interface{})
Debugln(args ...interface{})
Debugf(format string, args ...interface{})
DebugWithFields(msg string, KV KV)
Info(args ...interface{})
Infoln(args ...interface{})
Infof(format string, args ...interface{})
InfoWithFields(msg string, KV KV)
Warn(args ...interface{})
Warnln(args ...interface{})
Warnf(format string, args ...interface{})
WarnWithFields(msg string, KV KV)
Error(args ...interface{})
Errorln(args ...interface{})
Errorf(format string, args ...interface{})
ErrorWithFields(msg string, KV KV)
Errors(err error)
Fatal(args ...interface{})
Fatalln(args ...interface{})
Fatalf(format string, args ...interface{})
FatalWithFields(msg string, KV KV)
IsValid() bool // IsValid check if Logger is created using constructor
StdTrace(requestID string, contextID string, err error, metadata interface{}, message string)
StdTracef(requestID string, contextID string, err error, metadata interface{}, format string, args ...interface{})
StdDebug(requestID string, contextID string, err error, metadata interface{}, message string)
StdDebugf(requestID string, contextID string, err error, metadata interface{}, format string, args ...interface{})
StdInfo(requestID string, contextID string, err error, metadata interface{}, message string)
StdInfof(requestID string, contextID string, err error, metadata interface{}, format string, args ...interface{})
StdWarn(requestID string, contextID string, err error, metadata interface{}, message string)
StdWarnf(requestID string, contextID string, err error, metadata interface{}, format string, args ...interface{})
StdError(requestID string, contextID string, err error, metadata interface{}, message string)
StdErrorf(requestID string, contextID string, err error, metadata interface{}, format string, args ...interface{})
StdFatal(requestID string, contextID string, err error, metadata interface{}, message string)
StdFatalf(requestID string, contextID string, err error, metadata interface{}, format string, args ...interface{})
}
Logger interface
Click to show internal directories.
Click to hide internal directories.