[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:
Maycon Santos
2025-04-04 18:30:47 +02:00
committed by GitHub
parent 80702b9323
commit fbd783ad58
5 changed files with 40 additions and 4 deletions

View File

@@ -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 {