Skip to content

Instantly share code, notes, and snippets.

@evertlammerts
Last active August 23, 2018 01:46
Show Gist options
  • Save evertlammerts/96b4d9ecc3c71cd79bdf08e39736841a to your computer and use it in GitHub Desktop.
Save evertlammerts/96b4d9ecc3c71cd79bdf08e39736841a to your computer and use it in GitHub Desktop.
JSON schema v4 for Python's logging.config.dictConfig: https://docs.python.org/3/library/logging.config.html#logging-config-dictschema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "JSON schema for Python logging.config.dictConfig",
"type": "object",
"required": ["version"],
"properties": {
"version": {"type": "integer", "enum": [1]},
"formatters": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"type": "object",
"properties": {
"format": {"type": "string"},
"datefmt": {"type": "string"}
},
"additionalProperties": false
}
}
},
"filters": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"type": "object",
"properties": {
"name": {"type": "string"}
},
"additionalProperties": false
}
}
},
"handlers": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"type": "object",
"required": ["class"],
"properties": {
"class": {"type": "string"},
"level": {"type": "string"},
"formatter": {"type": "string"},
"filters": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
}
}
}
}
},
"loggers": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"type": "object",
"properties": {
"level": {"type": "string"},
"propagate": {"type": "boolean"},
"filters": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"handlers": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
}
}
}
}
},
"root": {
"type": "object",
"properties": {
"level": {
"type": "string",
"enum": [ "CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG" ]
},
"filters": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"handlers": {
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
}
}
},
"incremental": {"type": "boolean"},
"disable_existing_loggers": {"type": "boolean"}
}
}
@smcveigh-phunware
Copy link

suggest adding to formaters to support formatting other than %:

     ...
     "formatters": {
     ...
         "properties": {
            "format": {"type": "string"},
            "datefmt": {"type": "string"},
            "style": {"type": "string", "enum": ["%", "{", "$"]}
          }
     ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment