forked from gyozatech/noodlog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog_struct.go
75 lines (57 loc) · 2.1 KB
/
log_struct.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
package noodlog
// record struct represents the schema for every log record
type record struct {
Level string `json:"level,omitempty"`
File *string `json:"file,omitempty"`
Function *string `json:"function,omitempty"`
Message interface{} `json:"message,omitempty"`
Time string `json:"time,omitempty"`
}
// Configs struct contains all possible configs for noodlog
type Configs struct {
LogLevel *string
JSONPrettyPrint *bool
TraceCaller *bool
SinglePointTracing *bool
Colors *bool
CustomColors *CustomColors
ObscureSensitiveData *bool
SensitiveParams []string
}
// CustomColors struct is used to specify the custom colors for the various log levels
type CustomColors struct {
Trace interface{}
Debug interface{}
Info interface{}
Warn interface{}
Error interface{}
}
// ~~~~~~~~~~~ Prebuilt pointers to be used in the SetConfigs ~~~~~~~~~~~~ //
// LevelTrace pointer for the Config struct
var LevelTrace = pointerOfString(traceLabel)
// LevelDebug pointer for the Config struct
var LevelDebug = pointerOfString(debugLabel)
// LevelInfo pointer for the Config struct
var LevelInfo = pointerOfString(infoLabel)
// LevelWarn pointer for the Config struct
var LevelWarn = pointerOfString(warnLabel)
// LevelError pointer for the Config struct
var LevelError = pointerOfString(errorLabel)
// Enable pointer for the Config struct
var Enable = pointerOfBool(true)
// Disable pointer for the Config struct
var Disable = pointerOfBool(false)
// Default pointer for the CustomColors struct
var Default = pointerOfString(defaultColor)
// Red pointer for the CustomColors struct
var Red = pointerOfString(redColor)
// Green pointer for the CustomColors struct
var Green = pointerOfString(greenColor)
// Yellow pointer for the CustomColors struct
var Yellow = pointerOfString(yellowColor)
// Blue pointer for the CustomColors struct
var Blue = pointerOfString(blueColor)
// Purple pointer for the CustomColors struct
var Purple = pointerOfString(purpleColor)
// Cyan pointer for the CustomColors struct
var Cyan = pointerOfString(cyanColor)