Documentation
¶
Index ¶
- Variables
- func AppendTimestamp(b []byte, t time.Time) []byte
- func Debugf(format string, v ...any)
- func MockLogger(prefix string) (fmt.Stringer, func())
- func Noticef(format string, v ...any)
- func Panicf(format string, v ...any)
- func SecurityCritical(event SecurityEvent, arg, description string)
- func SecurityWarn(event SecurityEvent, arg, description string)
- func SetAppID(s string)
- type Logger
- type SecurityEvent
Constants ¶
This section is empty.
Variables ¶
View Source
var NullLogger = nullLogger{}
NullLogger is a logger that does nothing
Functions ¶
func AppendTimestamp ¶ added in v1.25.0
AppendTimestamp appends a timestamp in format "YYYY-MM-DDTHH:mm:ss.sssZ" to the given byte slice and returns the extended slice.
The timestamp is always in UTC and has exactly 3 fractional digits (millisecond precision). Makes no allocations if b has enough capacity.
func MockLogger ¶
MockLogger replaces the existing logger with a buffer and returns a Stringer returning the log buffer content and a restore function.
func SecurityCritical ¶ added in v1.24.0
func SecurityCritical(event SecurityEvent, arg, description string)
SecurityCritical logs a security CRITICAL event with the given arguments.
func SecurityWarn ¶ added in v1.24.0
func SecurityWarn(event SecurityEvent, arg, description string)
SecurityWarn logs a security WARN event with the given arguments.
Types ¶
type Logger ¶
type Logger interface {
// Notice is for messages that the user should see
Notice(msg string)
// Debug is for messages that the user should be able to find if they're debugging something
Debug(msg string)
}
A Logger is a fairly minimal logging tool.
type SecurityEvent ¶ added in v1.24.0
type SecurityEvent string
const ( SecurityAuthzAdmin SecurityEvent = "authz_admin" SecurityAuthzFail SecurityEvent = "authz_fail" SecurityUserCreated SecurityEvent = "user_created" SecurityUserDeleted SecurityEvent = "user_deleted" SecurityUserUpdated SecurityEvent = "user_updated" SecuritySysMonitorDisabled SecurityEvent = "sys_monitor_disabled" SecuritySysShutdown SecurityEvent = "sys_shutdown" SecuritySysStartup SecurityEvent = "sys_startup" )
Click to show internal directories.
Click to hide internal directories.