-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
factory.go
45 lines (38 loc) · 881 Bytes
/
factory.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
35
36
37
38
39
40
41
42
43
44
45
package log
import (
"context"
"github.com/sagernet/sing/common/observable"
)
type Factory interface {
Level() Level
SetLevel(level Level)
Logger() ContextLogger
NewLogger(tag string) ContextLogger
}
type ObservableFactory interface {
Factory
observable.Observable[Entry]
}
type Entry struct {
Level Level
Message string
}
type Logger interface {
Trace(args ...any)
Debug(args ...any)
Info(args ...any)
Warn(args ...any)
Error(args ...any)
Fatal(args ...any)
Panic(args ...any)
}
type ContextLogger interface {
Logger
TraceContext(ctx context.Context, args ...any)
DebugContext(ctx context.Context, args ...any)
InfoContext(ctx context.Context, args ...any)
WarnContext(ctx context.Context, args ...any)
ErrorContext(ctx context.Context, args ...any)
FatalContext(ctx context.Context, args ...any)
PanicContext(ctx context.Context, args ...any)
}