-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstant.go
69 lines (62 loc) · 1.85 KB
/
constant.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
package logadapter
// custom logtype
const (
LogTypeAPI = "api"
LogTypeRequest = "request"
LogTypeResponse = "response"
LogTypeError = "error"
LogTypeDebug = "debug"
LogTypeInfo = "info"
LogTypeWarn = "warn"
LogTypeSQL = "sql"
LogTypeTrace = "trace"
)
// custom constants
const (
DefaultTimestampFormat = "2006-01-02 15:04:05.00000"
DefaultPrefix = "LogAdapter_"
DefaultSourceField = "stack_trace"
)
// Export HeaderKey constanst
const (
CorrelationIDHeaderKey HeaderKey = "X-User-Correlation-Id"
RequestIDHeaderKey HeaderKey = "X-Request-ID"
UserInfoHeaderKey HeaderKey = "X-Userinfo"
)
// Export LogKey constanst
const (
CorrelationIDLogKey LogKey = "correlation_id"
RequestIDLogKey LogKey = "request_id"
UserInfoLogKey LogKey = "user_info"
)
// Export default LogKeyMap
var (
DefaultLogKeys []LogKey = []LogKey{CorrelationIDLogKey, RequestIDLogKey, UserInfoLogKey}
baseSourceDir string
)
// custom log format
const (
JSONFormat LogFormat = iota
PrettyJSONFormat
TextFormat
)
const (
// PanicLevel level, highest level of severity. Logs and then calls panic with the
// message passed to Debug, Info, ...
PanicLevel Level = iota
// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
// logging level is set to Panic.
FatalLevel
// ErrorLevel level. Logs. Used for errors that should definitely be noted.
// Commonly used for hooks to send errors to an error tracking service.
ErrorLevel
// WarnLevel level. Non-critical entries that deserve eyes.
WarnLevel
// InfoLevel level. General operational entries about what's going on inside the
// application.
InfoLevel
// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
DebugLevel
// TraceLevel level. Designates finer-grained informational events than the Debug.
TraceLevel
)