v0.1.11 harden logging lifecycle, sanitization, and formatter edge cases
Test / test (push) Canceled after 0s
Test / fuzz (./compat, FuzzParseFormat) (push) Canceled after 0s
Test / fuzz (./formatter, FuzzFormatJSON) (push) Canceled after 0s
Test / fuzz (./formatter, FuzzFormatTextPolicy) (push) Canceled after 0s
Test / fuzz (./sanitizer, FuzzSanitize) (push) Canceled after 0s
Test / fuzz (./sanitizer, FuzzSerializerJSON) (push) Canceled after 0s
Test / test (push) Canceled after 0s
Test / fuzz (./compat, FuzzParseFormat) (push) Canceled after 0s
Test / fuzz (./formatter, FuzzFormatJSON) (push) Canceled after 0s
Test / fuzz (./formatter, FuzzFormatTextPolicy) (push) Canceled after 0s
Test / fuzz (./sanitizer, FuzzSanitize) (push) Canceled after 0s
Test / fuzz (./sanitizer, FuzzSerializerJSON) (push) Canceled after 0s
This commit is contained in:
1 parent
79a81db3ca
commit
2417e51da1
46 files changed
+1846
-1289
No files matched your search
+13
-1
@@ -42,24 +42,36 @@ func WithFatalHandler(handler func(string)) GnetOption {
|
||||
|
||||
// Debugf logs at debug level with printf-style formatting
|
||||
func (a *GnetAdapter) Debugf(format string, args ...any) {
|
||||
if !a.logger.Enabled(log.LevelDebug) {
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
a.logger.Debug("msg", msg, "source", "gnet")
|
||||
}
|
||||
|
||||
// Infof logs at info level with printf-style formatting
|
||||
func (a *GnetAdapter) Infof(format string, args ...any) {
|
||||
if !a.logger.Enabled(log.LevelInfo) {
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
a.logger.Info("msg", msg, "source", "gnet")
|
||||
}
|
||||
|
||||
// Warnf logs at warn level with printf-style formatting
|
||||
func (a *GnetAdapter) Warnf(format string, args ...any) {
|
||||
if !a.logger.Enabled(log.LevelWarn) {
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
a.logger.Warn("msg", msg, "source", "gnet")
|
||||
}
|
||||
|
||||
// Errorf logs at error level with printf-style formatting
|
||||
func (a *GnetAdapter) Errorf(format string, args ...any) {
|
||||
if !a.logger.Enabled(log.LevelError) {
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
a.logger.Error("msg", msg, "source", "gnet")
|
||||
}
|
||||
@@ -75,4 +87,4 @@ func (a *GnetAdapter) Fatalf(format string, args ...any) {
|
||||
if a.fatalHandler != nil {
|
||||
a.fatalHandler(msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user