diff --git a/hub/executor/executor.go b/hub/executor/executor.go index 15b2d37a..60fb56e4 100644 --- a/hub/executor/executor.go +++ b/hub/executor/executor.go @@ -48,6 +48,9 @@ func updateRules(rules []C.Rule) { } func updateGeneral(general *config.General) { + log.SetLevel(general.LogLevel) + T.Instance().SetMode(general.Mode) + allowLan := general.AllowLan P.SetAllowLan(allowLan) @@ -62,7 +65,4 @@ func updateGeneral(general *config.General) { if err := P.ReCreateRedir(general.RedirPort); err != nil { log.Errorln("Start Redir server error: %s", err.Error()) } - - log.SetLevel(general.LogLevel) - T.Instance().SetMode(general.Mode) } diff --git a/log/level.go b/log/level.go index 2bdbad4d..a361f3c9 100644 --- a/log/level.go +++ b/log/level.go @@ -14,6 +14,7 @@ var ( "warning": WARNING, "info": INFO, "debug": DEBUG, + "silent": SILENT, } ) @@ -22,6 +23,7 @@ const ( INFO WARNING ERROR + SILENT ) type LogLevel int @@ -70,6 +72,8 @@ func (l LogLevel) String() string { return "error" case DEBUG: return "debug" + case SILENT: + return "silent" default: return "unknow" } diff --git a/proxy/redir/tcp.go b/proxy/redir/tcp.go index d54a17c4..ba55e458 100644 --- a/proxy/redir/tcp.go +++ b/proxy/redir/tcp.go @@ -4,9 +4,8 @@ import ( "net" "github.com/Dreamacro/clash/adapters/inbound" + "github.com/Dreamacro/clash/log" "github.com/Dreamacro/clash/tunnel" - - log "github.com/sirupsen/logrus" ) var ( @@ -27,7 +26,7 @@ func NewRedirProxy(addr string) (*redirListener, error) { rl := &redirListener{l, addr, false} go func() { - log.Infof("Redir proxy listening at: %s", addr) + log.Infoln("Redir proxy listening at: %s", addr) for { c, err := l.Accept() if err != nil { diff --git a/proxy/socks/tcp.go b/proxy/socks/tcp.go index a4d4db4b..badb8b18 100644 --- a/proxy/socks/tcp.go +++ b/proxy/socks/tcp.go @@ -4,10 +4,10 @@ import ( "net" "github.com/Dreamacro/clash/adapters/inbound" + "github.com/Dreamacro/clash/log" "github.com/Dreamacro/clash/tunnel" "github.com/Dreamacro/go-shadowsocks2/socks" - log "github.com/sirupsen/logrus" ) var ( @@ -28,7 +28,7 @@ func NewSocksProxy(addr string) (*sockListener, error) { sl := &sockListener{l, addr, false} go func() { - log.Infof("SOCKS proxy listening at: %s", addr) + log.Infoln("SOCKS proxy listening at: %s", addr) for { c, err := l.Accept() if err != nil {