Open moqmar opened 1 year ago
Hi.
I think this happens because we treat extra
as reserved because that's the keyword argument we have to use internally to pass additional properties for submission as log event properties:
https://github.com/tintoy/seqlog/blob/573912a0ce6c5016cfbf3692ef4b0f1f697fc4fa/seqlog/structured_logging.py#L189 https://github.com/tintoy/seqlog/blob/573912a0ce6c5016cfbf3692ef4b0f1f697fc4fa/seqlog/structured_logging.py#L22
I believe you can probably do what you want by using an argument whose name is other than extra
but as the logger is currently designed, anything passed in as extra
does not get added to the log event properties.
I guess I could explicitly take anything that appears under extra
and copy it into the log event but I'd need to put that behaviour behind a switch when configuring the logger (since there's no guarantee that other consumers are using extra
the same way and I don't want to break existing consumers if possible).
Would that work for you?
That would be great! Main reason why I'd like this is that libraries can then log extra things without considering whether the main application is later using Seq or not - in that case the main application has control over seqlog anyways, so a switch would work fine.
@tintoy Has that commit since been updated and/or fixed? or is this issue still ongoing?
Thanks for the reminder! I'd completely forgot about this one 🙂
I think this change is good to go (just need to publish a new package; I was trying to find some time to set up CI to automatically publish the package which has been holding that up but I'll try to manually publish it sometime today).
@moqmar does that update fix your issue?
Description
I'm trying to add named log properties without having to use logger calls that only work with seqlog. This means that I can't use the following, which obviously works with seqlog, but fails without it:
As an alternative, I have tried the following:
I'd have expected at least the latter to work, and would prefer the former to be includable as an "Extra" field in Seq, as I guess most extra information provided by libraries can be relevant.
What I Did