From 7a53af355e57f0730891ac3782e17e35629f95b9 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Sat, 10 Aug 2019 12:02:38 -0400 Subject: [PATCH] Emit the server software and version to the log on startup --- app.go | 7 ++++++- cmd/writefreely/main.go | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index dec0ef2..c52f59d 100644 --- a/app.go +++ b/app.go @@ -486,9 +486,14 @@ func ConnectToDatabase(app *App) error { return nil } +// FormatVersion constructs the version string for the application +func FormatVersion() string { + return serverSoftware + " " + softwareVer +} + // OutputVersion prints out the version of the application. func OutputVersion() { - fmt.Println(serverSoftware + " " + softwareVer) + fmt.Println(FormatVersion()) } // NewApp creates a new app instance. diff --git a/cmd/writefreely/main.go b/cmd/writefreely/main.go index 10cd7d6..48993c7 100644 --- a/cmd/writefreely/main.go +++ b/cmd/writefreely/main.go @@ -113,6 +113,7 @@ func main() { // Initialize the application var err error + log.Info("Starting %s...", writefreely.FormatVersion()) app, err = writefreely.Initialize(app, *debugPtr) if err != nil { log.Error("%s", err)