-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.go
42 lines (33 loc) · 853 Bytes
/
log.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
package ormx
import "context"
type Level int8
const (
// DebugLevel defines debug log level.
DebugLevel Level = iota
// InfoLevel defines info log level.
InfoLevel
// WarnLevel defines warn log level.
WarnLevel
// ErrorLevel defines error log level.
ErrorLevel
// FatalLevel defines fatal log level.
FatalLevel
// PanicLevel defines panic log level.
PanicLevel
// NoLevel defines an absent log level.
NoLevel
// Disabled disables the logger.
Disabled
// TraceLevel defines trace log level.
TraceLevel Level = -1
// Values less than TraceLevel are handled as numbers.
)
type Logger interface {
Printf(context.Context, Level, string, ...any)
}
type nopLogger struct{}
func (l nopLogger) Printf(ctx context.Context, level Level, format string, args ...any) {}
var log Logger = nopLogger{}
func SetLogger(l Logger) {
log = l
}