Skip to content

Commit

Permalink
add a bit more info to startup logs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnewhall committed Jul 12, 2024
1 parent 639fd22 commit c38ac50
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
19 changes: 14 additions & 5 deletions pkg/client/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package client

import (
"context"
"os"
"path"

"github.com/Notifiarr/notifiarr/pkg/mnd"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/client/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit c38ac50

Please sign in to comment.