Logging

Ingrid services write logs to stdout. It should not be confused with the available log services (e.g. log-stdout).

Level logging

Logging level Description
Trace Something very low level.
Debug Useful debugging information.
Info Something noteworthy happened!
Warn You should probably take a look at this.
Error Something failed but I’m not quitting.
Fatal Bye. (exits program)
Panic I’m bailing. (panics and exits program)

You can set the logging level, then it will only log entries with that severity or anything below it. If you set it to LOGLEVEL=Info for example (which is also the default value), it will log anything that is info or below (warn, error, fatal, panic).

Entries

These fields are automatically added to all logging events:

  1. time. The timestamp when the entry was created.
  2. msg. The logging message. E.g. A connection was successfully established.
  3. level. The logging level. E.g. info.

Formatters

Logging formatter Description
application/json JSON formatter
text/default Defaul text formatter with no options
text/keyvalue Text formatter with full timestamp and key value (e.g. key=value)
text/plain Raw formatter, used mostly for debugging

Sensitive log information

Some information might be sensitive and not everybody wants them to expose them to the logs. Set LOGSENSITIVE=true (default value is false) to log sensitive informations.

Rotation

Log rotation is not provided with the logger. Log rotation should be done by an external program (like docker) that can compress and delete old log entries. It should not be a feature of the application-level logger.