Documentation ¶
Index ¶
Constants ¶
View Source
const ( // TextFormat represents the text logging format. TextFormat log.OutputFormat = "text" // JSONFormat represents the JSON logging format. JSONFormat log.OutputFormat = "json" )
Supported log output formats.
View Source
const RFC3339NanoFixed = log.RFC3339NanoFixed
RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to ensure the formatted time is always the same number of characters.
Variables ¶
View Source
var G = log.G
G is a shorthand for GetLogger.
View Source
var L = log.L
L is an alias for the standard logger.
Functions ¶
func GetLogger ¶
GetLogger retrieves the current logger from the context. If no logger is available, the default logger is returned.
func SetFormat ¶ added in v1.6.22
func SetFormat(format OutputFormat) error
SetFormat sets the log output format.
Types ¶
type Level ¶ added in v1.6.22
Level is a logging level.
const ( // TraceLevel level. TraceLevel Level = log.TraceLevel // DebugLevel level. DebugLevel Level = log.DebugLevel // InfoLevel level. InfoLevel Level = log.InfoLevel // WarnLevel level. WarnLevel Level = log.WarnLevel // ErrorLevel level ErrorLevel Level = log.ErrorLevel // FatalLevel level. FatalLevel Level = log.FatalLevel // PanicLevel level. PanicLevel Level = log.PanicLevel )
Supported log levels.
type OutputFormat ¶ added in v1.6.24
type OutputFormat = log.OutputFormat
OutputFormat specifies a log output format.
Click to show internal directories.
Click to hide internal directories.