Verboser info on index updates

This commit is contained in:
Jakob Borg 2021-12-03 11:43:50 +01:00
parent 951b058952
commit 1a6159f765
3 changed files with 19 additions and 3 deletions

View File

@ -161,14 +161,14 @@ type serveOptions struct {
NoBrowser bool `help:"Do not start browser"`
NoRestart bool `env:"STNORESTART" help:"Do not restart Syncthing when exiting due to API/GUI command, upgrade, or crash"`
NoDefaultFolder bool `env:"STNODEFAULTFOLDER" help:"Don't create the \"default\" folder on first startup"`
NoUpgrade bool `env:"STNOUPGRADE" help:"Disable automatic upgrades"`
NoUpgrade bool `env:"STNOUPGRADE" help:"Disable automatic upgrades" default:"true"`
Paths bool `help:"Show configuration paths"`
Paused bool `help:"Start with all devices and folders paused"`
Unpaused bool `help:"Start with all devices and folders unpaused"`
Upgrade bool `help:"Perform upgrade"`
UpgradeCheck bool `help:"Check for available upgrade"`
UpgradeTo string `placeholder:"URL" help:"Force upgrade directly from specified URL"`
Verbose bool `help:"Print verbose log output"`
Verbose bool `help:"Print verbose log output" default:"true"`
Version bool `help:"Show version"`
// Debug options below

View File

@ -336,12 +336,28 @@ func (s *indexHandler) receive(fs []protocol.FileInfo, update bool, op string) e
}
fset.Update(deviceID, fs)
var minSeq, maxSeq int64
if len(fs) > 0 {
maxSeq, minSeq = fs[0].SequenceNo(), fs[0].SequenceNo()
for _, f := range fs {
if f.SequenceNo() < minSeq {
minSeq = f.SequenceNo()
}
if f.SequenceNo() > maxSeq {
maxSeq = f.SequenceNo()
}
}
}
seq := fset.Sequence(deviceID)
s.evLogger.Log(events.RemoteIndexUpdated, map[string]interface{}{
"device": deviceID.String(),
"folder": s.folder,
"items": len(fs),
"sequence": seq,
"update": update,
"minSeq": minSeq,
"maxSeq": maxSeq,
"version": seq, // legacy for sequence
})

View File

@ -80,7 +80,7 @@ func (s *verboseService) formatEvent(ev events.Event) string {
case events.RemoteIndexUpdated:
data := ev.Data.(map[string]interface{})
return fmt.Sprintf("Device %v sent an index update for %q with %d items", data["device"], data["folder"], data["items"])
return fmt.Sprintf("Device %v sent an index update for %q with %d items, sequence %d-%d => %d, update %v", data["device"], data["folder"], data["items"], data["minSeq"], data["maxSeq"], data["sequence"], data["update"])
case events.DeviceRejected:
data := ev.Data.(map[string]string)