From c38ac503f46423a6e5719c2f15f6dbcbff6b67f1 Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Fri, 12 Jul 2024 15:47:53 -0700 Subject: [PATCH] add a bit more info to startup logs --- pkg/client/init.go | 19 ++++++++++++++----- pkg/client/start.go | 7 ++++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/pkg/client/init.go b/pkg/client/init.go index a60863cb5..161889b87 100644 --- a/pkg/client/init.go +++ b/pkg/client/init.go @@ -7,6 +7,7 @@ package client import ( "context" + "os" "path" "github.com/Notifiarr/notifiarr/pkg/mnd" @@ -42,8 +43,10 @@ func (c *Client) PrintStartupInfo(ctx context.Context, clientInfo *clientinfo.Cl c.Printf("==> Unique Host ID: %s (%s)", hi.HostID, hi.Hostname) } + hostname, _ := os.Hostname() + c.Printf("==> %s <==", mnd.HelpLink) - c.Printf("==> Startup Settings <==") + c.Printf("==> %s Startup Settings <==", hostname) c.printLidarr(&clientInfo.Actions.Apps.Lidarr) c.printProwlarr(&clientInfo.Actions.Apps.Prowlarr) c.printRadarr(&clientInfo.Actions.Apps.Radarr) @@ -83,15 +86,21 @@ func (c *Client) printVersionChangeInfo(ctx context.Context) { c.Errorf("XX> Getting version from database: %v", err) } + currentVersion := version.Version + "-" + version.Revision previousVersion := string(values[clientVersion]) - if previousVersion == version.Version || - version.Version == "" { + + if previousVersion == currentVersion || version.Version == "" { return } - c.Printf("==> Detected application version change! %s => %s", previousVersion, version.Version) + if previousVersion == "" { + hostname, _ := os.Hostname() + c.Printf("==> Detected a new client, %s. Welcome to Notifiarr!", hostname) + } else { + c.Printf("==> Detected application version change! %s => %s", previousVersion, currentVersion) + } - err = c.website.SetState(ctx, clientVersion, []byte(version.Version)) + err = c.website.SetState(ctx, clientVersion, []byte(currentVersion)) if err != nil { c.Errorf("Updating version in database: %v", err) } diff --git a/pkg/client/start.go b/pkg/client/start.go index 99c1c894b..00b28c4d6 100644 --- a/pkg/client/start.go +++ b/pkg/client/start.go @@ -151,9 +151,10 @@ func (c *Client) start(ctx context.Context) error { //nolint:cyclop } c.Logger.SetupLogging(c.Config.LogConfig) - c.Printf(" %s %s v%s-%s Starting! [PID: %v] %s", - mnd.TodaysEmoji(), c.Flags.Name(), version.Version, version.Revision, os.Getpid(), - version.Started.Format("Monday, January 2, 2006 @ 3:04:05 PM MST -0700")) + c.Printf(" %s %s v%s-%s Starting! [PID: %v, UID: %d, GID: %d] %s", + mnd.TodaysEmoji(), mnd.Title, version.Version, version.Revision, + os.Getpid(), os.Getuid(), os.Getgid(), + version.Started.Format("Mon, Jan 2, 2006 @ 3:04:05 PM MST -0700")) c.Printf("==> %s", msg) c.printUpdateMessage()