I am using dictConfig to setup logging. One of the requirements I have is to change the default converter of the formatter (I am using a single formatter simpleFormatter for all my handlers) to time.gmtime. This would be done like this:
formatter.converter = time.gmtime
If I had access to the formatter. But I don't, so I can not change the default converter. I can think of two ways of doing what I want:
- pass the relevant parameter via
dictConfig, in theformatterssection (something like'converter': 'ext://time.gmtime') But I think this extra parameter is not supported bydictConfig - get the formatter after doing a
dictConfigand apply the configuration manually:formatter.converter = time.gmtime. I do not know how to get the formatter by name, or whether it is supported or if would be hacking around thelogging.configmodule.
I have found neither examples, nor documentation, nor a way to implement this after taking a look at the source code of the logging module.
Has somebody managed to setup the formatter.converter using a dictConfig setup?