mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-27 14:59:09 +01:00
Add context to throughout the project and update logging (#2209)
propagate context from all the API calls and log request ID, account ID and peer ID --------- Co-authored-by: Zoltan Papp <zoltan.pmail@gmail.com>
This commit is contained in:
co-authored by
Zoltan Papp
parent
7cb81f1d70
commit
765aba2c1c
+6
-1
@@ -2,6 +2,7 @@ package util
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
@@ -30,7 +31,11 @@ func InitLog(logLevel string, logPath string) error {
|
||||
log.SetOutput(io.Writer(lumberjackLogger))
|
||||
}
|
||||
|
||||
formatter.SetTextFormatter(log.StandardLogger())
|
||||
if os.Getenv("NB_LOG_FORMAT") == "json" {
|
||||
formatter.SetJSONFormatter(log.StandardLogger())
|
||||
} else {
|
||||
formatter.SetTextFormatter(log.StandardLogger())
|
||||
}
|
||||
log.SetLevel(level)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user