-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
66 lines (55 loc) · 1.63 KB
/
types.go
File metadata and controls
66 lines (55 loc) · 1.63 KB
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
package emit
import "io"
// LogLevel represents the logging level
type LogLevel int
const (
DEBUG LogLevel = iota
INFO
WARN
ERROR
)
// OutputFormat represents the output format type
type OutputFormat int
const (
JSON_FORMAT OutputFormat = iota
PLAIN_FORMAT
)
// SensitiveDataMode represents how to handle sensitive data
type SensitiveDataMode int
const (
MASK_SENSITIVE SensitiveDataMode = iota // Default: mask sensitive data
SHOW_SENSITIVE // Show sensitive data (not recommended for production)
)
// PIIDataMode represents how to handle PII data
type PIIDataMode int
const (
MASK_PII PIIDataMode = iota // Default: mask PII data
SHOW_PII // Show PII data (not recommended for production)
)
// LogEntry represents a structured log entry for Kubernetes
type LogEntry struct {
Timestamp string `json:"timestamp"`
Level string `json:"level"`
Message string `json:"message"`
Component string `json:"component,omitempty"`
Version string `json:"version,omitempty"`
File string `json:"file,omitempty"`
Line int `json:"line,omitempty"`
Function string `json:"function,omitempty"`
Fields map[string]any `json:"fields,omitempty"`
}
// Logger represents the JSON logger
type Logger struct {
level LogLevel
component string
version string
writer io.Writer
showCaller bool
format OutputFormat
sensitiveMode SensitiveDataMode
piiMode PIIDataMode
sensitiveFields []string
piiFields []string
maskString string
piiMaskString string
}