-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.go
104 lines (71 loc) · 2.34 KB
/
interface.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// FIle: "interface.go"
package xlog
import (
"log"
"log/slog" // go>=1.21
//"golang.org/x/exp/slog" // depricated for go>=1.21
)
// Xlog interface
type Xlogger interface {
// Extract *slog.Logger from Xlog (Xlog -> *slog.Logger)
Slog() *slog.Logger
// Set Xlog logger as default xlog logger
SetDefault()
// Set Xlog logger as default xlog/log/slog loggers
SetDefaultLogs()
// Return log level as int (slog.Level)
GetLevel() slog.Level
// Set log level as int (slog.Level)
SetLevel(level slog.Level)
// Return log level as string
GetLvl() string
// Set log level as string
SetLvl(level string)
// Use xlog as io.Writer: log to level Info
Write(p []byte) (n int, err error)
// Return standart logger with prefix
NewLog(prefix string) *log.Logger
// Log logs at given level
Log(level slog.Level, msg string, args ...any)
// Flood logs at LevelFlood
Flood(msg string, args ...any)
// Trace logs at LevelTrace
Trace(msg string, args ...any)
// Debug logs at LevelDebug
Debug(msg string, args ...any)
// Info logs at LevelInfo
Info(msg string, args ...any)
// Notice logs at LevelNotice
Notice(msg string, args ...any)
// Warn logs at LevelWarn
Warn(msg string, args ...any)
// Error logs at LevelError
Error(msg string, args ...any)
// Crit logs at LevelCritical
Crit(msg string, args ...any)
// Fatal logs at LevelFatal and os.Exit(1)
Fatal(msg string, args ...any)
// Panic logs at LevelPanic and panic
Panic(msg string)
// Logf logs at given level as standart logger
Logf(level slog.Level, format string, args ...any)
// Floodf logs at LevelFlood as standart logger
Floodf(format string, args ...any)
// Tracef logs at LevelTrace as standart logger
Tracef(format string, args ...any)
// Debugf logs at LevelDebug as standart logger
Debugf(format string, args ...any)
// Infof logs at LevelInfo as standart logger
Infof(format string, args ...any)
// Noticef logs at LevelNotice as standart logger
Noticef(format string, args ...any)
// Warnf logs at LevelWarn as standart logger
Warnf(format string, args ...any)
// Errorf logs at LevelError as standart logger
Errorf(format string, args ...any)
// Critf logs at LevelCritical as standart logger
Critf(format string, args ...any)
// Fatalf logs at LevelFatal as standart logger and os.Exit(1)
Fatalf(format string, args ...any)
}
// EOF: "interface.go"