Hi,
for logging in my application I do roughly this:
import logging, tomllib, time
log = logging.getLogger("my_app")
def setup_logging():
logging.Formatter.converter = time.gmtime # <--- can this be done in toml below?
config_file = pathlib.Path("logging_conf.toml")
# toml contents at: https://paste.rs/Jg5Ap.txt
with open(config_file, "rb") as fh:
config = tomllib.load(fh)
logging.config.dictConfig(config)
if __name__ == "__main__":
setup_logging()
# ...
Can I specify the part that says logging.Formatter.converter = time.gmtime
per logger in the dict that I pass to dictConfig
somehow?
This does not seem to work:
[formatters.simple]
format = "%(asctime)s [%(levelname)-8.8s|%(module)-14.14s]: %(message)s :[%(name)s]"
datefmt = "%Y-%m-%dZ%H:%M:%S"
converter = "ext://time.gmtime" # also not without the `ext://`
The complete logging_conf.toml
is here: Source Code | Jg5Ap | Rocket Powered Pastebin