Skip to content

ramzesich/python-json-logger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Fork of the madzak/python-json-logger library with additional features:

  • support for static extra fields passed to the Formatter constructor
  • support for custom format field names

JSON configuration example

    "formatters": {
        "json": {
            "()": "pythonjsonlogger.jsonlogger.JsonFormatter",
            "format": "%(asctime)s %(levelname)s %(name)s %(message)s",
            "datefmt": "%Y-%m-%d %H:%M:%S",
            "custom_format_field_names": {
                "asctime": "timestamp",
                "name": "subsystem",
                "levelname": "eventtype"
            },
            "static_fields": {
                "system": "smadapter",
                "host": "playmark"
            }
        },
        "human_readable": {
            "format": "%(asctime)s %(levelname)-7s %(name)-20s: %(message)s",
            "datefmt": "%Y-%m-%d %H:%M:%S"
        }
    }

About

Json Formatter for the standard python logger

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%