-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlogger.go
More file actions
153 lines (136 loc) · 4.45 KB
/
logger.go
File metadata and controls
153 lines (136 loc) · 4.45 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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package forge
import "github.com/xraph/forge/internal/logger"
// Re-export logger interfaces for 100% v1 compatibility.
type (
Logger = logger.Logger
SugarLogger = logger.SugarLogger
Field = logger.Field
LogLevel = logger.LogLevel
LoggingConfig = logger.LoggingConfig
LoggerConfig = logger.LoggingConfig
)
// Re-export logger constants.
const (
LevelInfo = logger.LevelInfo
LevelWarn = logger.LevelWarn
LevelError = logger.LevelError
LevelFatal = logger.LevelFatal
LevelDebug = logger.LevelDebug
)
// Re-export logger constructors.
var (
NewLogger = logger.NewLogger
NewDevelopmentLogger = logger.NewDevelopmentLogger
NewBeautifulLogger = logger.NewBeautifulLogger
NewProductionLogger = logger.NewProductionLogger
NewNoopLogger = logger.NewNoopLogger
GetGlobalLogger = logger.GetGlobalLogger
SetGlobalLogger = logger.SetGlobalLogger
)
// Field constructors for structured logging.
var (
// String creates a string field.
String = logger.String
// Int creates an int field.
Int = logger.Int
// Int8 creates an int8 field.
Int8 = logger.Int8
// Int16 creates an int16 field.
Int16 = logger.Int16
// Int32 creates an int32 field.
Int32 = logger.Int32
// Int64 creates an int64 field.
Int64 = logger.Int64
// Uint creates a uint field.
Uint = logger.Uint
// Uint8 creates a uint8 field.
Uint8 = logger.Uint8
// Uint16 creates a uint16 field.
Uint16 = logger.Uint16
// Uint32 creates a uint32 field.
Uint32 = logger.Uint32
// Uint64 creates a uint64 field.
Uint64 = logger.Uint64
// Float32 creates a float32 field.
Float32 = logger.Float32
// Float64 creates a float64 field.
Float64 = logger.Float64
// Bool creates a bool field.
Bool = logger.Bool
// Time creates a time field.
Time = logger.Time
// Duration creates a duration field.
Duration = logger.Duration
// Error creates an error field.
Error = logger.Error
// Stringer creates a field from a Stringer.
Stringer = logger.Stringer
// Any creates a field from any value.
Any = logger.Any
// Stack creates a stack trace field.
Stack = logger.Stack
// Strings creates a string slice field.
Strings = logger.Strings
// HTTPMethod creates an HTTP method field.
HTTPMethod = logger.HTTPMethod
// HTTPStatus creates an HTTP status field.
HTTPStatus = logger.HTTPStatus
// HTTPPath creates an HTTP path field.
HTTPPath = logger.HTTPPath
// HTTPURL creates an HTTP URL field.
HTTPURL = logger.HTTPURL
// HTTPUserAgent creates an HTTP user agent field.
HTTPUserAgent = logger.HTTPUserAgent
// DatabaseQuery creates a database query field.
DatabaseQuery = logger.DatabaseQuery
// DatabaseTable creates a database table field.
DatabaseTable = logger.DatabaseTable
// DatabaseRows creates a database rows affected field.
DatabaseRows = logger.DatabaseRows
// ServiceName creates a service name field.
ServiceName = logger.ServiceName
// ServiceVersion creates a service version field.
ServiceVersion = logger.ServiceVersion
// ServiceEnvironment creates a service environment field.
ServiceEnvironment = logger.ServiceEnvironment
// RequestID creates a request ID field.
RequestID = logger.RequestID
// TraceID creates a trace ID field.
TraceID = logger.TraceID
// UserID creates a user ID field.
UserID = logger.UserID
// ContextFields creates fields from context.
ContextFields = logger.ContextFields
// Custom creates a custom field.
Custom = logger.Custom
// Lazy creates a lazily evaluated field.
Lazy = logger.Lazy
)
// Re-export context helpers (note: WithLogger conflicts with context.go, use logger.WithLogger directly).
var (
LoggerFromContext = logger.LoggerFromContext
WithRequestID = logger.WithRequestID
RequestIDFromContext = logger.RequestIDFromContext
WithTraceID = logger.WithTraceID
TraceIDFromContext = logger.TraceIDFromContext
WithUserID = logger.WithUserID
UserIDFromContext = logger.UserIDFromContext
)
// Re-export utility functions.
var (
Track = logger.Track
TrackWithLogger = logger.TrackWithLogger
TrackWithFields = logger.TrackWithFields
LogPanic = logger.LogPanic
LogPanicWithFields = logger.LogPanicWithFields
)
// Re-export field groups.
var (
HTTPRequestGroup = logger.HTTPRequestGroup
DatabaseQueryGroup = logger.DatabaseQueryGroup
ServiceInfoGroup = logger.ServiceInfoGroup
)
// F creates a new field (alias for Any for backwards compatibility with Phase 7).
func F(key string, value any) Field {
return logger.Any(key, value)
}