Skip to content

feat: Overhaul logging behavior #173

@Histalek

Description

@Histalek

Current behavior

Gatus spams the journal with errors (priority=3, log-level=error) as every message from Gatus is logged the same way.

I'm running Gatus in a container with podman and the journald logging driver.

Expected behavior

Log messages from Gatus are logged with an appropriate log-level. Not spamming the journal with error messages that are essentially no errors.

Proposition

  1. Log output to stdout and log diagnostic information about Gatus itself to stderr
  2. Give every log message proper log-levels

Reasoning and other comments

The current behavior is most likely caused by logging everything to stderr without explicitly setting a log-level/priority (log.go does this by default).

IMO stderr should be used for diagnostic information, e.g. listening address, database connection, configuration changes and validation, anything needed to possibly oversee the operation of Gatus itself.
Watchdog messages should then instead be logged to stdout, because these messages are more likely the output of Gatus and should be handled as such.
Especially for watchdog messages i'd like to see INFO for successful checks and WARN for unsuccessful checks as the log-level.

I'm not sure if all of this is possible with log.go, maybe something like logrus, zerolog or zap would be more suitable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions