-
Notifications
You must be signed in to change notification settings - Fork 1.4k
NullTarget - Improve thread concurrency when FormatMessage = false #6036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughTwo protected override async write handlers were added to NullTarget: they check the FormatMessage flag and either delegate to the base implementation or increment a thread-safe counter and complete continuations without formatting. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Logger
participant NullTarget
participant BaseTarget as Base
note right of NullTarget #DDFFDD: New WriteAsyncThreadSafe overrides
Logger->>NullTarget: WriteAsyncThreadSafe(event or events)
alt FormatMessage == true
NullTarget->>Base: base.WriteAsyncThreadSafe(...)
Base-->>NullTarget: Completed (may format)
NullTarget-->>Logger: Continuation completed
else FormatMessage == false
NullTarget->>NullTarget: Interlocked.Add/_logEventCounter++\nComplete continuations with null
NullTarget-->>Logger: Continuation completed
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)src/NLog/Targets/NullTarget.cs (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/NLog/Targets/NullTarget.cs(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/NLog/Targets/NullTarget.cs (1)
src/NLog/Targets/Target.cs (2)
WriteAsyncThreadSafe(610-623)WriteAsyncThreadSafe(648-664)
🔇 Additional comments (1)
src/NLog/Targets/NullTarget.cs (1)
36-39: LGTM! Using directives are necessary.All three new using directives are required for the added functionality:
System.Collections.GenericforIList<AsyncLogEventInfo>System.ThreadingforInterlockedoperationsNLog.CommonforAsyncLogEventInfotype
1f94a3c to
e3a9dbd
Compare
|


No description provided.