Documentation
¶
Index ¶
- func Debug(msg string, args ...any)
- func Diagnostic(event DiagnosticEvent)
- func Error(msg string, args ...any)
- func Info(msg string, args ...any)
- func Init() (io.Closer, error)
- func L() *slog.Logger
- func ProfileFallback(scope, profile string)
- func Recover(what string, locks ...Lock)
- func SetLogger(l *slog.Logger) *slog.Logger
- func Supervise(ctx context.Context, what string, fn func(), locks ...Lock)
- func UseStderr(w io.Writer)
- func Warn(msg string, args ...any)
- type DiagnosticEvent
- type Lock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diagnostic ¶
func Diagnostic(event DiagnosticEvent)
func ProfileFallback ¶
func ProfileFallback(scope, profile string)
func Recover ¶ added in v0.21.9
Recover, deferred first thing in a background goroutine, logs a panic there with its stack and ends only that goroutine, so the daemon and every other session keep running: `defer log.Recover("what", &m.mu)`. locks are the mutexes the goroutine's code may hold without a deferred unlock; one still held after the panic would hang every later caller, so the process exits instead, as an unrecovered panic would have.
func SetLogger ¶
SetLogger swaps the package logger and returns the previous one, so callers (chiefly tests) can install a capturing handler and restore it afterwards.
func Supervise ¶ added in v0.21.9
Supervise runs fn, a long-running loop, until it returns or ctx ends. A panic in fn is handled as Recover does and fn runs again after a backoff, so a loop the service depends on is never left stopped.