Skip to content

Commit

Permalink
Feature: add silent info level
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamacro committed Dec 3, 2018
1 parent 6636db2 commit ca6e67a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions hub/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
4 changes: 4 additions & 0 deletions log/level.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var (
"warning": WARNING,
"info": INFO,
"debug": DEBUG,
"silent": SILENT,
}
)

Expand All @@ -22,6 +23,7 @@ const (
INFO
WARNING
ERROR
SILENT
)

type LogLevel int
Expand Down Expand Up @@ -70,6 +72,8 @@ func (l LogLevel) String() string {
return "error"
case DEBUG:
return "debug"
case SILENT:
return "silent"
default:
return "unknow"
}
Expand Down
5 changes: 2 additions & 3 deletions proxy/redir/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions proxy/socks/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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 {
Expand Down

0 comments on commit ca6e67a

Please sign in to comment.