From 8a98eea8fadc4894ae6faef6bd110df809705bcd Mon Sep 17 00:00:00 2001 From: Kr328 Date: Thu, 23 Apr 2020 18:52:23 +0800 Subject: [PATCH] improve core log --- core/src/main/golang/bridge/proxies.go | 4 ++++ core/src/main/golang/tun/log.go | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/src/main/golang/bridge/proxies.go b/core/src/main/golang/bridge/proxies.go index b0a5d57..0d1b729 100644 --- a/core/src/main/golang/bridge/proxies.go +++ b/core/src/main/golang/bridge/proxies.go @@ -106,20 +106,24 @@ func QueryAllProxyGroups(collection ProxyGroupCollection) { func SetSelectedProxy(name, proxy string) bool { p := tunnel.Proxies()[name] if p == nil { + log.Infoln("Set %s: Not such proxy group", name) return false } pb, ok := p.(*outbound.Proxy) if !ok { + log.Infoln("Set %s: Not a proxy object", name) return false } selector, ok := pb.ProxyAdapter.(*outboundgroup.Selector) if !ok { + log.Infoln("Set %s: Not a selector group", name) return false } if err := selector.Set(proxy); err != nil { + log.Infoln("Set %s: %s", name, err.Error()) return false } diff --git a/core/src/main/golang/tun/log.go b/core/src/main/golang/tun/log.go index 6a750e8..7eafb1b 100644 --- a/core/src/main/golang/tun/log.go +++ b/core/src/main/golang/tun/log.go @@ -5,17 +5,17 @@ import "github.com/Dreamacro/clash/log" type ClashLogger struct{} func (c *ClashLogger) D(format string, args ...interface{}) { - log.Debugln(format, args) + log.Debugln(format, args...) } func (c *ClashLogger) I(format string, args ...interface{}) { - log.Infoln(format, args) + log.Infoln(format, args...) } func (c *ClashLogger) W(format string, args ...interface{}) { - log.Warnln(format, args) + log.Warnln(format, args...) } func (c *ClashLogger) E(format string, args ...interface{}) { - log.Errorln(format, args) + log.Errorln(format, args...) }