Skip to content

Commit

Permalink
cmd/syncthing: Print version information early (fixes #5891) (#5893)
Browse files Browse the repository at this point in the history
  • Loading branch information
calmh committed Jul 27, 2019
1 parent 35f40e9 commit d0c3697
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 8 additions & 0 deletions cmd/syncthing/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,14 @@ func upgradeViaRest() error {
}

func syncthingMain(runtimeOptions RuntimeOptions) {
// Set a log prefix similar to the ID we will have later on, or early log
// lines look ugly.
l.SetPrefix("[start] ")

// Print our version information up front, so any crash that happens
// early etc. will have it available.
l.Infoln(build.LongVersion)

// Ensure that we have a certificate and key.
cert, err := tls.LoadX509KeyPair(
locations.Get(locations.CertFile),
Expand Down
7 changes: 1 addition & 6 deletions lib/syncthing/syncthing.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@ func (a *App) startup() error {
})
a.mainService.ServeBackground()

// Set a log prefix similar to the ID we will have later on, or early log
// lines look ugly.
l.SetPrefix("[start] ")

if a.opts.AuditWriter != nil {
a.mainService.Add(newAuditService(a.opts.AuditWriter))
}
Expand All @@ -147,10 +143,9 @@ func (a *App) startup() error {
// report the error if there is one.
osutil.MaximizeOpenFileLimit()

// Figure out our device ID, set it as the log prefix and log it.
a.myID = protocol.NewDeviceID(a.cert.Certificate[0])
l.SetPrefix(fmt.Sprintf("[%s] ", a.myID.String()[:5]))

l.Infoln(build.LongVersion)
l.Infoln("My ID:", a.myID)

// Select SHA256 implementation and report. Affected by the
Expand Down

0 comments on commit d0c3697

Please sign in to comment.