Documentation ¶
Overview ¶
Package logging provides an application logging solution by wrapping an existing logging library. The functionality is provided as an interface so that applications only need to depend on this logic. The underlying logging implementation can be easily switched if this is a requirement
Index ¶
Constants ¶
View Source
const ( // LogFieldNameFunction identifies the function in structured logging LogFieldNameFunction = "function" // RequestIDKey identifies a reqest in structured logging RequestIDKey = "requestID" // ApplicationNameKey identifies the application in structured logging ApplicationNameKey = "appName" // HostIDKey identifies the host in structured logging HostIDKey = "hostID" // ErrorKey identifies errors ErrorKey = "err" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyValue ¶
type KeyValue interface {
Read() []string
}
KeyValue defines a combination of Key and Value
type LogConfig ¶
type LogConfig struct { FilePath string LogLevel string Trace TraceConfig // GrayLogServer defines the address of a log-aggregator using Graylog GrayLogServer string }
LogConfig specifies logging settings for
type Logger ¶
type Logger interface { // implement the io.Closer interface io.Closer // Info logs a message and values with logging-level INFO Info(msg string, keyvals ...KeyValue) // Info logs a message and values with logging-level DEBUG Debug(msg string, keyvals ...KeyValue) // Warn logs a message and values with logging-level WARNING Warn(msg string, keyvals ...KeyValue) // Error logs a message and values with logging-level ERROR Error(msg string, keyvals ...KeyValue) // InfoRequest is used to log a *http.Request (with a Trace-ID, if available) InfoRequest(msg string, req *http.Request, keyvals ...KeyValue) // ErrorRequest is used to log a *http.Request (with a Trace-ID, if available) ErrorRequest(msg string, req *http.Request, keyvals ...KeyValue) }
Logger interface defines common logging functions for applications
type TraceConfig ¶
TraceConfig is used to correlate logging-entries
Click to show internal directories.
Click to hide internal directories.