fluffynuts commented on code in PR #365:
URL: https://github.com/apache/logging-log4net/pull/365#discussion_r4639142638
##########
src/log4net/Core/LoggingEvent.cs:
##########
@@ -1222,19 +1238,23 @@ protected virtual void FixVolatileData(FixFlags flags)
_cacheUpdatable = false;
}
- private void CreateCompositeProperties()
+ /// <summary>
+ /// Composes the event's, the calling thread's (when <paramref
name="withThreadContexts"/>) and the global properties.
+ /// </summary>
+ private CompositeProperties CreateCompositeProperties(bool
withThreadContexts)
{
CompositeProperties compositeProperties = new();
if (_eventProperties is not null)
{
compositeProperties.Add(_eventProperties);
}
- if (LogicalThreadContext.Properties.GetProperties(false) is
PropertiesDictionary logicalThreadProperties)
+ if (withThreadContexts
Review Comment:
minor: this could have one check for `withThreadContexts` and do the two
checks for thread properties inside that, instead of testing the boolean twice,
ie:
```csharp
if (withThreadContexts)
{
if (LogicalThreadContext.Properties.GetProperties(false) is
PropertiesDictionary logicalThreadProperties)
{
compositeProperties.Add(logicalThreadProperties);
}
if (ThreadContext.Properties.GetProperties(false) is
PropertiesDictionary threadProperties)
{
compositeProperties.Add(threadProperties);
}
}
```
(Rider also points out that the `is` check here can be `is {}`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]