Documentation ¶
Index ¶
- func AddRequestLogger(ctx context.Context, baseLogger *slog.Logger) (context.Context, *slog.Logger)
- func Fatal(logger *slog.Logger, msg string, keyvals ...interface{})
- func GetSystemLogger() *slog.Logger
- func LogWithoutAuth(msg string, keyvals ...interface{})
- func NewNopLogger() *slog.Logger
- func ReqLogger(ctx context.Context) *slog.Logger
- func SetSystemLogger(logger *slog.Logger)
- func SetupStdoutLogging() *slog.Logger
- func SystemLog(msg string, keyvals ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 Fatal ¶
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 GetSystemLogger ¶
func LogWithoutAuth ¶
func LogWithoutAuth(msg string, keyvals ...interface{})
func NewNopLogger ¶
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 SetSystemLogger ¶
func SetupStdoutLogging ¶
SetupStdoutLogging creates a new logger that logs to standard out
func SystemLog ¶
func SystemLog(msg string, keyvals ...interface{})
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 ¶
This section is empty.