serilog-extensions-logging icon indicating copy to clipboard operation
serilog-extensions-logging copied to clipboard

Property in LogEvent should not be overridden by scope

Open huoshan12345 opened this issue 1 year ago • 3 comments

fixes #271

NOTE: ExternalScopeProvider.ForEachScope processes scopes from outer to inner, which is the opposite of Serilog's scope traversal order. This fix implements ForEachScopeReversed and passes update: false to the method EnrichWithStateAndCreateScopeItem to ensure consistent behavior matching Serilog's expectations.

huoshan12345 avatar Apr 01 '25 14:04 huoshan12345

Thanks for sending this. Because the method is called for every log statement, I'm not sure the added cost of creating, populating, and iterating through an additional List will be acceptable. We might need to investigate alternative approaches to #289 instead 🤔

nblumhardt avatar Apr 01 '25 22:04 nblumhardt

Thanks for sending this. Because the method is called for every log statement, I'm not sure the added cost of creating, populating, and iterating through an additional List will be acceptable. We might need to investigate alternative approaches to #289 instead 🤔

Thanks for reviewing the PR! I'm glad you brought this up - I've been exploring solutions but haven't found a better approach yet. By the way, I noticed you referenced #289, but I don't seem to have access to that issue. Is it a private issue perhaps?

huoshan12345 avatar Apr 02 '25 00:04 huoshan12345

Sorry! The PR I meant to refer to is #269.

nblumhardt avatar Apr 02 '25 00:04 nblumhardt