Debian Codegraph @

interfaces.go

raw symbols SCIP
1 package logg
2
3 import (
4 "fmt"
5 "time"
6 )
7
8 // Logger is the main interface for the logger.
9 type Logger interface {
10 // WithLevel returns a new entry with `level` set.
11 WithLevel(Level) *Entry
12 }
13
14 // LevelLogger is the logger at a given level.
15 type LevelLogger interface {
16 // Log logs a message at the given level using the string from calling s.String().
17 // Note that s.String() will not be called if the level is not enabled.
18 Log(s fmt.Stringer)
19
20 // Logf logs a message at the given level using the format and args from calling fmt.Sprintf().
21 // Note that fmt.Sprintf() will not be called if the level is not enabled.
22 Logf(format string, a ...any)
23
24 // WithLevel returns a new entry with `level` set.
25 WithLevel(Level) *Entry
26
27 // WithFields returns a new entry with the`fields` in fields set.
28 // This is a noop if LevelLogger's level is less than Logger's.
29 WithFields(fields Fielder) *Entry
30
31 // WithLevel returns a new entry with the field f set with value v
32 // This is a noop if LevelLogger's level is less than Logger's.
33 WithField(f string, v any) *Entry
34
35 // WithDuration returns a new entry with the "duration" field set
36 // to the given duration in milliseconds.
37 // This is a noop if LevelLogger's level is less than Logger's.
38 WithDuration(time.Duration) *Entry
39
40 // WithError returns a new entry with the "error" set to `err`.
41 // This is a noop if err is nil or LevelLogger's level is less than Logger's.
42 WithError(error) *Entry
43 }