six8 / logaware

Python Logger that is context aware
BSD 2-Clause "Simplified" License
2 stars 2 forks source link

If `extra` is passed as a keyword argument, it gets added to the log record as `extra.extra` #10

Open six8 opened 4 years ago

six8 commented 4 years ago

Example:

logger.error(message, extra={"foo": "bar"})

logaware will treat extra as a regular keyword argument which eventually gets added as a key to the LogRecord.extra property. So you end up with a log record like:

record.extra["extra"] == {"foo": "bar"}

logaware does not use extra, but the standard library logger does. For better compatibility with the standard library, logware should merge extra with kwargs so it is not double-nested.