From 76b949fbfca5a80d990048791ac1258fc8bb027d Mon Sep 17 00:00:00 2001 From: Sebastien Douheret Date: Fri, 6 Oct 2017 18:08:05 +0200 Subject: [PATCH] Fix syncthing logger --- glide.yaml | 2 +- lib/syncthing/st.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/glide.yaml b/glide.yaml index e017281..08a3fed 100644 --- a/glide.yaml +++ b/glide.yaml @@ -25,7 +25,7 @@ import: - package: github.com/satori/go.uuid version: ^1.1.0 - package: github.com/iotbzh/xds-common - version: 4b8e35b6786b + version: 1bf428d6b4ba subpackages: - golib/common - golib/eows diff --git a/lib/syncthing/st.go b/lib/syncthing/st.go index e8e9f44..b14f40d 100644 --- a/lib/syncthing/st.go +++ b/lib/syncthing/st.go @@ -316,7 +316,12 @@ func (s *SyncThing) Connect() error { common.HTTPClientConfig{ URLPrefix: "/rest", HeaderClientKeyName: "X-Syncthing-ID", + LogOut: s.conf.LogVerboseOut, + LogPrefix: "SYNCTHING: ", + LogLevel: common.HTTPLogLevelWarning, }) + s.client.SetLogLevel(s.log.Level.String()) + if err != nil { msg := ": " + err.Error() if strings.Contains(err.Error(), "connection refused") { @@ -328,11 +333,6 @@ func (s *SyncThing) Connect() error { return fmt.Errorf("ERROR: cannot connect to Syncthing (null client)") } - // Redirect HTTP log into a file - s.client.SetLogLevel(s.conf.Log.Level.String()) - s.client.LoggerPrefix = "SYNCTHING: " - s.client.LoggerOut = s.conf.LogVerboseOut - s.MyID, err = s.IDGet() if err != nil { return fmt.Errorf("ERROR: cannot retrieve ID") -- 2.16.6