mirror of
https://github.com/netbirdio/netbird.git
synced 2025-08-18 19:09:09 +02:00
[client] Use the netbird logger for ice and grpc (#3603)
updates the logging implementation to use the netbird logger for both ICE and gRPC components. The key changes include: - Introducing a gRPC logger configuration in util/log.go that integrates with the netbird logging setup. - Updating the log hook in formatter/hook/hook.go to ensure a default caller is used when not set. - Refactoring ICE agent and UDP multiplexers to use a unified logger via the new getLogger() method.
This commit is contained in:
@@ -3,6 +3,7 @@ package hook
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
|
||||
@@ -40,8 +41,12 @@ func (hook ContextHook) Levels() []logrus.Level {
|
||||
|
||||
// Fire extend with the source information the entry.Data
|
||||
func (hook ContextHook) Fire(entry *logrus.Entry) error {
|
||||
src := hook.parseSrc(entry.Caller.File)
|
||||
entry.Data[EntryKeySource] = fmt.Sprintf("%s:%v", src, entry.Caller.Line)
|
||||
caller := &runtime.Frame{Line: 0, File: "caller_not_available"}
|
||||
if entry.Caller != nil {
|
||||
caller = entry.Caller
|
||||
}
|
||||
src := hook.parseSrc(caller.File)
|
||||
entry.Data[EntryKeySource] = fmt.Sprintf("%s:%v", src, caller.Line)
|
||||
additionalEntries(entry)
|
||||
|
||||
if entry.Context == nil {
|
||||
|
Reference in New Issue
Block a user