Nacelle

Go service framework
/

Logging environment variable configuration

Environment variables available to the Nacelle process change the behavior of the loggers when using the bootstrapper.


Environment VariableDefaultDescription
LOG_COLORIZEtrueColorize log messages by level when true. Works with console encoding only.
LOG_JSON_FIELD_NAMESA JSON-encoded map to rename the fields for message, timestamp, and/or level.
LOG_DISPLAY_FIELDStrueOmit log fields from output when false. Works with console encoding only.
LOG_DISPLAY_MULTILINE_FIELDSfalsePrint fields on one line when true, one field per line when false. Works with console encoding only.
LOG_ENCODINGconsoleconsole for human-readable output and json for JSON-formatted output.
LOG_FIELD_BLACKLISTA JSON-encoded list of fields to omit from logs. Works with console encoding only.
LOG_FIELDSA JSON-encoded map of fields to include in every log.
LOG_LEVELinfoThe highest level that will be emitted.
LOG_SHORT_TIMEfalseOmit date from timestamp when true. Works with console encoding only.
Examples

Example output when using the default configuration:

[I] [2019/07/24 09:15:30.806] Accepted request from 68.6.165.7 caller=derision/main.go:20 requestId=12341234-1234-1234-1234-123412341234 sequenceNumber=2

Example output when using LOG_ENCODING=json:

{"caller":"derision/main.go:20","level":"info","message":"Accepted request from 68.6.165.7","requestId":"12341234-1234-1234-1234-123412341234","sequenceNumber":2,"timestamp":"2019-07-24T09:16:55.673-0700"}

Example output when using LOG_DISPLAY_FIELDS=false:

[I] [2019/07/24 09:15:49.517] Accepted request from 68.6.165.7

Example output when using LOG_SHORT_TIME=true:

[I] [09:17:56] Accepted request from 68.6.165.7 caller=derision/main.go:20 requestId=12341234-1234-1234-1234-123412341234 sequenceNumber=2

Example output when using LOG_DISPLAY_MULTILINE_FIELDS=true:

[I] [2019/07/24 09:16:38.117] Accepted request from 68.6.165.7
    caller = derision/main.go:20
    requestId = 12341234-1234-1234-1234-123412341234
    sequenceNumber = 2