mirror of
https://github.com/netbirdio/netbird.git
synced 2026-03-31 06:24:18 -04:00
[client] Fix duplicate log lines in containers (#5609)
This commit is contained in:
@@ -103,7 +103,7 @@ func (p *program) Stop(srv service.Service) error {
|
||||
|
||||
// Common setup for service control commands
|
||||
func setupServiceControlCommand(cmd *cobra.Command, ctx context.Context, cancel context.CancelFunc) (service.Service, error) {
|
||||
SetFlagsFromEnvVars(rootCmd)
|
||||
// rootCmd env vars are already applied by PersistentPreRunE.
|
||||
SetFlagsFromEnvVars(serviceCmd)
|
||||
|
||||
cmd.SetOut(cmd.OutOrStdout())
|
||||
|
||||
@@ -43,7 +43,13 @@ func InitLogger(logger *log.Logger, logLevel string, logs ...string) error {
|
||||
var writers []io.Writer
|
||||
logFmt := os.Getenv("NB_LOG_FORMAT")
|
||||
|
||||
seen := make(map[string]bool, len(logs))
|
||||
for _, logPath := range logs {
|
||||
if seen[logPath] {
|
||||
continue
|
||||
}
|
||||
seen[logPath] = true
|
||||
|
||||
switch logPath {
|
||||
case LogSyslog:
|
||||
AddSyslogHookToLogger(logger)
|
||||
|
||||
Reference in New Issue
Block a user