Fix syncthing logger
[src/xds/xds-server.git] / lib / syncthing / st.go
index bc65299..b14f40d 100644 (file)
@@ -101,7 +101,7 @@ func NewSyncThing(conf *xdsconfig.Config, log *logrus.Logger) *SyncThing {
        }
 
        if url == "" {
-               url = "http://localhost:8384"
+               url = "http://localhost:8385"
        }
        if url[0:7] != "http://" {
                url = "http://" + url
@@ -227,7 +227,6 @@ func (s *SyncThing) Start() (*exec.Cmd, error) {
        env := []string{
                "STNODEFAULTFOLDER=1",
                "STNOUPGRADE=1",
-               "STNORESTART=1", // FIXME SEB remove ?
        }
 
        s.STCmd, err = s.startProc("syncthing", args, env, &s.exitSTChan)
@@ -317,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") {
@@ -329,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")