From b654198e3f9546025eaac5ae5fd9c305a29347ad Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Fri, 13 Feb 2026 21:15:09 +0000 Subject: [PATCH] Simplify log output on startup --- db/connection.go | 7 +++---- main.go | 5 ++--- platform/email/template.go | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/db/connection.go b/db/connection.go index 7636dd4a..8d8a6a3e 100644 --- a/db/connection.go +++ b/db/connection.go @@ -33,7 +33,7 @@ var ( ) func doMigrations(connection_string string) error { - log.Info().Str("dsn", connection_string).Msg("Connecting to database") + log.Debug().Str("dsn", connection_string).Msg("Connecting to database") db, err := sql.Open("pgx", connection_string) if err != nil { return fmt.Errorf("Failed to open database connection: %w", err) @@ -76,7 +76,7 @@ func doMigrations(connection_string string) error { } func InitializeDatabase(ctx context.Context, uri string) error { - log.Info().Str("dsn", uri).Msg("Connecting to database") + log.Debug().Str("dsn", uri).Msg("Initializing database") needs, err := needsMigrations(uri) if err != nil { return fmt.Errorf("Failed to determine if migrations are needed: %w", err) @@ -92,7 +92,7 @@ func InitializeDatabase(ctx context.Context, uri string) error { return fmt.Errorf("Failed to handle migrations: %w", err) } } else { - log.Info().Msg("No database migrations necessary") + log.Debug().Msg("No database migrations necessary") } pgOnce.Do(func() { @@ -111,7 +111,6 @@ func InitializeDatabase(ctx context.Context, uri string) error { if err != nil { return fmt.Errorf("Failed to get database current: %w", err) } - log.Info().Str("database", current).Msg("Connected to database") err = prepareStatements(ctx) if err != nil { return fmt.Errorf("Failed to initialize prepared statements: %w", err) diff --git a/main.go b/main.go index eaa5ff55..63e68d98 100644 --- a/main.go +++ b/main.go @@ -38,7 +38,6 @@ func main() { log.Error().Err(err).Msg("Failed to parse config") os.Exit(1) } - log.Info().Msg("Starting...") var prod = flag.Bool("prod", false, "Force into production mode") flag.Parse() @@ -76,7 +75,7 @@ func main() { defer sentryWriter.Close() zerolog.TimeFieldFormat = zerolog.TimeFormatUnix - log.Logger = log.Output(zerolog.MultiLevelWriter(zerolog.ConsoleWriter{Out: os.Stderr}, sentryWriter)) + log.Logger = log.Output(zerolog.MultiLevelWriter(zerolog.ConsoleWriter{Out: os.Stderr}, sentryWriter)).Level(zerolog.InfoLevel) err = db.InitializeDatabase(context.TODO(), config.PGDSN) if err != nil { @@ -131,7 +130,7 @@ func main() { hr.Map(config.DomainNidus, sr) r.Mount("/", hr) - log.Info().Str("report url", config.DomainRMO).Str("sync url", config.DomainNidus).Msg("Serving at URLs") + log.Debug().Str("report url", config.DomainRMO).Str("sync url", config.DomainNidus).Msg("Serving at URLs") // Start up background processes ctx, cancel := context.WithCancel(context.Background()) diff --git a/platform/email/template.go b/platform/email/template.go index 0eba3377..927acd00 100644 --- a/platform/email/template.go +++ b/platform/email/template.go @@ -88,7 +88,7 @@ func LoadTemplates() error { templateTXT: template_txt, } templateByID[template_id] = &built - log.Info().Int32("id", template_id).Str("name", name).Msg("Added template to cache") + //log.Debug().Int32("id", template_id).Str("name", name).Msg("Added template to cache") } templateInitialID, err = loadTemplateID(ctx, tx, enums.CommsMessagetypeemailInitialContact) if err != nil {