I would like to use the following log format:
'format': '{"message": "%(message)s", "user": "%(user)s"}'
However, I would like to call it in two different ways:
log.info("hi", extra={"user": "asmith"})
log.info("hi")
The first log statement works because it provides the user argument, but the second one fails with a KeyError.
Is there any way to make a format string argument optional?