mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 23:16:53 +00:00
log: allow external definition of log handling (#1561)
* poc * linter: fix --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -264,12 +264,22 @@ func (l *fields) stage(header string, deferFunc deferral) {
|
||||
logFieldsPool.Put(l)
|
||||
}
|
||||
|
||||
// stageln stages a log event
|
||||
func (l *fields) stageln(header string, a ...interface{}) {
|
||||
// stageln logs a message with the given header and arguments. It uses the
|
||||
// custom log hook if set, otherwise falls back to the library's internal log
|
||||
// system.
|
||||
func (l *fields) stageln(header string, a ...any) {
|
||||
if customLogHook != nil && customLogHook(header, l.name, a...) {
|
||||
return
|
||||
}
|
||||
l.stage(header, func() string { return fmt.Sprint(a...) })
|
||||
}
|
||||
|
||||
// stagef stages a log event
|
||||
func (l *fields) stagef(header, format string, a ...interface{}) {
|
||||
// stagef logs a formatted message with the given header and arguments. It uses
|
||||
// the custom log hook if set, otherwise falls back to the library's internal
|
||||
// log system.
|
||||
func (l *fields) stagef(header, format string, a ...any) {
|
||||
if customLogHook != nil && customLogHook(header, l.name, fmt.Sprintf(format, a...)) {
|
||||
return
|
||||
}
|
||||
l.stage(header, func() string { return fmt.Sprintf(format, a...) })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user