Skip to content

Latest commit

 

History

History
21 lines (18 loc) · 813 Bytes

File metadata and controls

21 lines (18 loc) · 813 Bytes

Python Epilog.

Epilog provides the following additional features over the core logging module:

  • New log level NOTICE as per Syslog standard.
  • Custom timestamp formatting (defaulting to ISO 8601 in UTC)
  • Support for JSON and text formatted logs

Environment variables:

  • LOG_LEVEL: Set the logging level (default: INFO)
  • LOG_FORMAT: Set the logging format (json or text, default: text if stdout is a terminal, otherwise json)
  • LOG_TIMESTAMP_FORMAT: Set the timestamp format (default: ISO 8601 in UTC)
  • LOG_TIMESTAMP_FIELD: Set the timestamp field name in JSON logs (default: timestamp)

Usage:

  from epilog import EpiLog
  logger = EpiLog(__name__)
  logger.setLevel(logging.DEBUG) #  Probably redundant, use LOG_LEVEL 
  logger.notice(msg)
  logger.info(msg, extra={field: value, ...}