From 1f46ebc21d07fba4330431e07a78df6eaf10ad57 Mon Sep 17 00:00:00 2001 From: Jacob Brewer Date: Wed, 14 Feb 2024 08:52:29 +0000 Subject: [PATCH] fix(logging): Changing some debug logs to be info logs where appropriate (#63) Changing some debug logs to be info logs where appropiate --- cmd/summary/cmd_serve.go | 6 +++--- cmd/summary/health.go | 2 +- cmd/summary/main.go | 2 +- cmd/summary/purge.go | 2 +- pkg/dataaccess/purge.go | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/summary/cmd_serve.go b/cmd/summary/cmd_serve.go index 87ba0572..b21f5dd9 100644 --- a/cmd/summary/cmd_serve.go +++ b/cmd/summary/cmd_serve.go @@ -90,7 +90,7 @@ func (s *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{ slog.Error("Error setting up purge routine", slog.String(logging.KeyError, err.Error())) } } else { - slog.Debug("Auto purge not set, data will not be purged") + slog.Info("Auto purge not set, data will not be purged") } srv := &http.Server{ @@ -102,14 +102,14 @@ func (s *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, _ ...interface{ go func(srv *http.Server) { err := srv.ListenAndServe() if errors.Is(err, http.ErrServerClosed) { - slog.Debug("Server closed gracefully") + slog.Info("Server closed gracefully") } else if err != nil { slog.Error("Error serving requests", slog.String(logging.KeyError, err.Error())) } }(srv) <-ctx.Done() - slog.Debug("Shutting down application") + slog.Info("Shutting down application") if err := srv.Shutdown(ctx); err != nil { slog.Error("Error shutting down application", slog.String(logging.KeyError, err.Error())) return subcommands.ExitFailure diff --git a/cmd/summary/health.go b/cmd/summary/health.go index 2bfe7498..09000152 100644 --- a/cmd/summary/health.go +++ b/cmd/summary/health.go @@ -33,7 +33,7 @@ func healthHandler() Controller { MaxTimeInError: 0, MaxContiguousFails: 0, StatusListener: func(ctx context.Context, name string, state health.CheckState) { - slog.Debug("Database health check status changed", + slog.Info("Database health check status changed", slog.String("name", name), slog.String("state", string(state.Status)), ) diff --git a/cmd/summary/main.go b/cmd/summary/main.go index c6603510..1bf24926 100644 --- a/cmd/summary/main.go +++ b/cmd/summary/main.go @@ -36,7 +36,7 @@ func main() { sig := make(chan os.Signal, 1) signal.Notify(sig, os.Interrupt, syscall.SIGTERM) got := <-sig - slog.Debug("Received signal, shutting down", slog.String("signal", got.String())) + slog.Info("Received signal, shutting down", slog.String("signal", got.String())) cancel() }() diff --git a/cmd/summary/purge.go b/cmd/summary/purge.go index 46aad0e6..c571233c 100644 --- a/cmd/summary/purge.go +++ b/cmd/summary/purge.go @@ -19,7 +19,7 @@ func setupPurge(purgeDays int) error { } c.Start() - slog.Debug("Cron scheduler started") + slog.Info("Cron scheduler started") return nil } diff --git a/pkg/dataaccess/purge.go b/pkg/dataaccess/purge.go index 68c77800..110be76a 100644 --- a/pkg/dataaccess/purge.go +++ b/pkg/dataaccess/purge.go @@ -16,7 +16,7 @@ func Purge(from time.Time) error { if err != nil { return fmt.Errorf("error purging data: %w", err) } else { - slog.Debug("Data purged from database", slog.Int("affected", affected)) + slog.Info("Data purged from database", slog.Int("affected", affected)) } // Purge the data from Files out of the given range. @@ -24,7 +24,7 @@ func Purge(from time.Time) error { if err != nil { return fmt.Errorf("error purging data: %w", err) } else { - slog.Debug("Data purged from Files", slog.Int("affected", affected)) + slog.Info("Data purged from Files interface", slog.Int("affected", affected)) } return nil } @@ -44,7 +44,7 @@ func PurgeAll() error { if err != nil { return fmt.Errorf("error purging data: %w", err) } else { - slog.Debug("Data purged from database", slog.Int("affected", affected)) + slog.Info("Data purged from database", slog.Int("affected", affected)) } // Purge the data from Files out of the given range. @@ -52,7 +52,7 @@ func PurgeAll() error { if err != nil { return fmt.Errorf("error purging data: %w", err) } else { - slog.Debug("Data purged from Files", slog.Int("affected", affected)) + slog.Info("Data purged from Files interface", slog.Int("affected", affected)) } return nil