Documentation
¶
Index ¶
Constants ¶
const ( // Print the level information of the final message, if requested PartOrderLevel = 0x0 // Print the timestamp information of the final message, if requested PartOrderTimestamp = 0x1 // Print the level correlation id of the final message, if requested PartOrderCorrelationId = 0x2 // Print the level information of the final message. Always printed PartOrderMessage = 0x3 // Print the level information of the final message, only if there is one extra parameter PartOrderExtra = 0x4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ExtraParametersFormat ExtraParametersFormatCallback
CustomLogFormat CustomLogFormatCallback
CustomTime CustomTimeCallback
Level Level
TimeFormat string
ExtraParametersPrefix string
Order []PartOrder
SkipPrintLevel bool
SkipPrintCorrelationID bool
SkipPrintTimestamp bool
SkipExtraParameterPrefix bool
}
LoggerConfig is the configuration of the logger behavior
type Context ¶
type Context interface {
CorrID() string
Extras() []K
Clone() Context
CloneNoExtra() Context
AddExtra(extra ...K)
}
Context contains all context information for a log message plus extra arguments
type CustomLogFormatCallback ¶
type CustomLogFormatCallback func(CustomLogFormatData) string
CustomLogFormatCallback defines the format of the final message
type CustomLogFormatData ¶
type CustomLogFormatData struct {
Level Level
Message string
CurrentTime time.Time
CorrelationID string
ExtraParams []K
}
CustomLogFormatData defines input parameters used to format a log message
type CustomTimeCallback ¶
CustomTimeCallback defines the time value written to the final message
type ExtraParametersFormatCallback ¶
ExtraParametersFormatCallback defines the format of the string conversion of the parameter in K struct format
type Factory ¶
LoggerFactory defines the behavior of the factory used to generate logging from a template at runtime
type K ¶
type K struct {
N string
V interface{}
}
K is used to define a log message ctx parameter, using Name/Value form
type Logger ¶
type Logger interface {
Info(ctx Context, msg string, params ...interface{})
Debug(ctx Context, msg string, params ...interface{})
Trace(ctx Context, msg string, params ...interface{})
Error(ctx Context, msg string, params ...interface{})
Warn(ctx Context, msg string, params ...interface{})
BeginMethod(ctx Context)
BeginMethodParams(ctx Context, format string, params ...interface{})
EndMethod(ctx Context)
EndMethodParams(ctx Context, format string, params ...interface{})
}
Logger abstract the selected log backend