# Functions
Debug writes fields+text in a fixed format with debug severity to the registered logger.
Debugf writes fields+text in a fixed format with debug severity to the registered logger.
Debugln writes fields+text in a fixed format with debug severity to the registered logger.
Error writes fields+text in a fixed format with error severity to the registered logger.
Errorf writes fields+text in a fixed format with error severity to the registered logger.
Errorln writes fields+text in a fixed format with error severity to the registered logger.
Fatal is equivalent to Print() followed by a call to os.Exit(1).
Fatalf is equivalent to Printf() followed by a call to os.Exit(1).
Fatalln is equivalent to Println() followed by a call to os.Exit(1).
GetDefaultLogger returns the default logger setup during package init.
GetLevel returns the minimum severity level to send to an output destination.
GetLogger returns the configured standard logger.
GetOutput gets the output destination of the registered logger.
Info writes fields+text in a fixed format with info severity to the registered logger.
Infof writes fields+text in a fixed format with info severity to the registered logger.
Infoln writes fields+text in a fixed format with info severity to the registered logger.
Levels returns a slice of all severity levels.
NewCommandLogger returns a logger configured for CLI programs.
NewServiceLogger returns a logger configured with a minimum set of standard fields.
Panic is equivalent to Print() followed by a call to panic().
Panicf is equivalent to Printf() followed by a call to panic().
Panicln is equivalent to Println() followed by a call to panic().
ParseLevel returns a severity Level from its string value.
Print writes fields+text in a fixed format to the registered logger.
Printf writes fields+text in a fixed format to the registered logger.
Println writes fields+text in a fixed format to the registered logger.
SetLevel sets the logging severity level on the registered logger.
SetLogger sets the registered logger.
SetOutput sets the output destination for the registered logger.
Warn writes fields+text in a fixed format with warn severity to the registered logger.
Warnf writes fields+text in a fixed format with warn severity to the registered logger.
Warning writes fields+text in a fixed format with warn severity to the registered logger.
Warningf writes fields+text in a fixed format with warn severity to the registered logger.
Warningln writes fields+text in a fixed format with warn severity to the registered logger.
Warnln writes fields+text in a fixed format with warn severity to the registered logger.
WithError returns a Logger configured to write an error field.
WithField returns a Logger configured to write the given field.
WithFields returns a Logger configured to write the given fields.
# Constants
Logging categories.
Logging categories.
DefaultMinLevel is the default minimum logging level.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Deprecated fields.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Better zero values.
Common structured-logging fields:
Field name Description ========== =========== msg Left empty (reserved, automatically set by the Logger) time Time request was processed (reserved, auto set by the Logger) level Logging level that is always set to INFO (reserved, auto set by the Logger)
category Category of log message (e.g., access, application) service Name of the service responsible for the log entry localaddr Network address of a local service localport Network port of a local service duration Duration in milliseconds reqlen Request body length in bytes (e.g., http.Request.Headers[Content-Length]) method Request method (e.g., http.Request.Method) uri Request URI (e.g., http.Request.RequestURI) proto Request protocol (e.g., http.Request.Proto) remoteaddr Network address of a remote address (e.g., http.Request.RemoteAddr) remoteport Network port of a remote service status Response status code (loggedResponseWriter.code) authuser Authenticated username authgroups Authenticated groups authroles Authenticated roles
Notes: 1) authuser,authgroups and authroles fields require handler.Authn.
Log-entry severities.
Log-entry severities.
Log-entry severities.
Log-entry severities.
Log-entry severities.
Log-entry severities.
Log-entry severities.
# Interfaces
FieldsExporter provides a way for types to export loggable fields.
GoStdLogger are most of what's exported by Go's log package with some exceptions.
Logger extends GoStdLogger with levels and structured fields.