Documentation
¶
Overview ¶
Package log configures a global logger and exports common logging functions. It is a very light wrapper over Zap. This logger utilizes an init() function and has no internal dependencies. This makes it easy to import and start using. Logs are always written to stdout. If the QU_LOG_FILE environment variable is set, logs are also appended to that file. Each process instance is tagged with a unique "restart" UUID so log entries can be correlated across restarts. This package might need more environment variables to configure some common settings, like log level and stack traces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
Debug logs a message with level == 'debug'. Takes arbitrary key value pairs which are added as extra fields in the output.
log.Debug( "nothing happened", // message "honk", "mimimimi", // key value pairs "number", 1, "key_without_value", // ignored )
func Error ¶
Error logs a message with level == 'error'. Takes arbitrary key value pairs which are added as extra fields in the output.
log.Error( "something failed", // message "error", err, // key value pairs "number", 3, "key_without_value", // ignored )
func Info ¶
Info logs a message with level == 'info'. Takes arbitrary key value pairs which are added as extra fields in the output.
log.Info( "something happended", // message "nothing", "gets", // key value pairs "past", "my bow!", "key_without_value", // ignored )
func Panic ¶
Panic logs a message with level == 'panic'. It immediately calls panic() after. This is safe to call in DB functions and Gin Routes; the recovery middleware will handle it. Takes arbitrary key value pairs which are added as extra fields in the output.
log.Panic( "i died", // message "error", err, // key value pairs "number", 4, "key_without_value", // ignored )
Types ¶
This section is empty.