From ec41861e773934c3a00e5761a938943f0aa3b2d5 Mon Sep 17 00:00:00 2001 From: dnomd343 Date: Sun, 28 Aug 2022 01:32:00 +0800 Subject: [PATCH] fix: log level settings --- cmd/config/decode.go | 4 ++-- cmd/proxy/config.go | 3 +++ cmd/proxy/main.go | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/config/decode.go b/cmd/config/decode.go index 48594e8..af0f602 100644 --- a/cmd/config/decode.go +++ b/cmd/config/decode.go @@ -13,8 +13,8 @@ import ( ) type NetConfig struct { - Gateway string `yaml:"gateway"` // network gateway - Address string `yaml:"address"` // network address + Gateway string `yaml:"gateway" json:"gateway"` // network gateway + Address string `yaml:"address" json:"address"` // network address } type RawConfig struct { diff --git a/cmd/proxy/config.go b/cmd/proxy/config.go index 508b891..86afa8f 100644 --- a/cmd/proxy/config.go +++ b/cmd/proxy/config.go @@ -44,6 +44,9 @@ type inboundObject struct { } func loadLogConfig(logLevel string, logDir string) string { + if logLevel == "" { + logLevel = "warning" // using warning level without log output + } if logLevel != "debug" && logLevel != "info" && logLevel != "warning" && logLevel != "error" && logLevel != "none" { log.Warningf("Unknown log level -> %s", logLevel) diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index b2ebfe8..6f62d3b 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -7,7 +7,7 @@ import ( ) type Config struct { - Log string `yaml:"log" json:"json"` + Log string `yaml:"log" json:"log"` Core string `yaml:"core" json:"core"` Http map[string]int `yaml:"http" json:"http"` Socks map[string]int `yaml:"socks" json:"socks"`