logging module of python 3.x allows for 3 ways to define a custom logger:
- INI-formatted file
- dict, json, yaml
- python (directly in code)
In my opinion, it is easier to define a custom logger’s config directly in the code, because this does not require anyone to understand other formats (it is not obvious what the dependencies are in INI, yaml, and json formats). If config is written in python, then any coder can understand how the Formatter, Handler, and Logger relate to each other programmatically, if not conceptually.
Are there reasons why it is better to define the logging config in a separate config file? I’m guessing this would have to do with wanting multiple deploys with different logging levels, but I can’t imagine a compelling use case for this.