-
Notifications
You must be signed in to change notification settings - Fork 1
/
doc.go
34 lines (34 loc) · 985 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Package slog provides concurrent levelled logging capabilities
// with parent/child loggers.
//
// * Concurrent safe
// * Three levels; `slog.Err`, `slog.Warn`, and `slog.Info`
// * Children loggers for sub-processes
// * Built-in zero-memory `slog.NilLogger` to easily logging off without changing calling code
// * Custom reporters to send logs anywhere
// * `Reporters` function for reporting to many places
//
// Usage
//
// Using slog.Logger is very simple:
//
// // make a logger to output to stdout
// l := slog.New("parent", slog.Warn)
// l.SetReporter(slog.Stdout)
// if l.Info() {
// l.Info("This is some information")
// }
// if l.Err() {
// l.Err("failed to do something:", err)
// }
//
// // start a sub process
// cl := l.New("child")
// StartSubProcess(cl)
// // reports as parent>child
//
// // stop the logger
// l.Stop()
// <-l.StopChan() // wait for it to stop
//
package slog