tintoy / seqlog

Python logging integration for Seq (https://getseq.net)
https://seqlog.readthedocs.io/
MIT License
16 stars 11 forks source link

Shorten SeqLogHandler._build_event_data() by cleaning up repeated code #54

Closed Vacant0mens closed 1 year ago

Vacant0mens commented 1 year ago

Focused a bit more on generating the event_data dict instead of updating the record object, and moved the byte and json encoding, as well as the event_data declaration to make the code more DRY.

The if's more directly check that the record has the log_props or args properties to save from checking if its an instance of StructuredLogRecord, and adding items directly to the dict, removing the need for log_props_shim.

This could potentially also have performance benefits, but they'd likely be fairly minimal.