Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatal ¶
func Fatal(logger Logger, keyvals ...interface{})
Fatal is an effective copy of go's log.Fatal, but using the logger provided, rather than using go's native logging. After writing the message, the code will exit with code 1
func Log ¶
Log provides a shorthand for the following code: ReqLogger(myContext).Log(/*your values here*/)
func SetSystemLogger ¶
func SetSystemLogger(logger Logger)
func SystemLog ¶
func SystemLog(keyvals ...interface{}) error
SystemLog provides a system-level logger, which is not tied to any request. this should be used in situations where either a context is not handy, but logging is important or for events that are not tied to a request (e.g. losing database connection)
Types ¶
type Logger ¶
Logger is a generic logging interface. Currently wraps Go-kit's log.Logger
func AddRequestLogger ¶
AddRequestLogger adds a logger to this request. The logger will provide unique identification for any request in this stream (via the "ctx" field in the log). The logger can be retrieved via
func GetSystemLogger ¶
func GetSystemLogger() Logger
func NewNopLogger ¶
func NewNopLogger() Logger
NewNopLogger creates a logger that actually does not log. useful in situations where some logger is needed, but for whatever reason, a real logger is missing (or if you want to conditionally) disable logging.
func ReqLogger ¶
ReqLogger retrieves a stored initially stored with AddRequestLogger. This logger is tied to the request (or more specifically, the context). Assuming you only have a request handy, the code to retrieve the logger is: logging.ReqLogger(r.Context())
func SetupStdoutLogging ¶
func SetupStdoutLogging() Logger
SetupStdoutLogging creates a new logger that logs to standard out