@@ -15,20 +15,25 @@ import (
15
15
"golang.org/x/exp/slog/internal/buffer"
16
16
)
17
17
18
- // A Handler processes log records produced by Logger output.
18
+ // A Handler handles log records produced by a Logger..
19
+ //
20
+ // A typical handler may print log records to standard error,
21
+ // or write them to a file or database, or perhaps augment them
22
+ // with additional attributes and pass them on to another handler.
23
+ //
19
24
// Any of the Handler's methods may be called concurrently with itself
20
25
// or with other methods. It is the responsibility of the Handler to
21
26
// manage this concurrency.
22
27
type Handler interface {
23
- // Enabled reports whether this handler is accepting records
24
- // at the given level.
28
+ // Enabled reports whether the handler handles records at the given level.
29
+ // The handler ignores records whose level is lower .
25
30
Enabled (Level ) bool
26
31
27
- // Handle processes the Record.
32
+ // Handle handles the Record.
28
33
// Handle methods that produce output should observe the following rules:
29
- // - If r.Time() is the zero time, do not output the time.
30
- // - If r.Level() is Level(0), do not output the level.
31
- // - If an Attr's key is the empty string, do not output the Attr.
34
+ // - If r.Time() is the zero time, ignore the time.
35
+ // - If r.Level() is Level(0), ignore the level.
36
+ // - If an Attr's key is the empty string, ignore the Attr.
32
37
Handle (r Record ) error
33
38
34
39
// With returns a new Handler whose attributes consist of
0 commit comments