-
Notifications
You must be signed in to change notification settings - Fork 165
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
NLogBufferingTargetWrapperMiddleware for AspNetBufferingTargetWrapper #900
NLogBufferingTargetWrapperMiddleware for AspNetBufferingTargetWrapper #900
Conversation
@bakgerman Have attached minimal-changes version of AspNetBufferingTargetWrapper.zip Hopefully GitHub will recognize it as a standard move-operation with minimal changes. |
Committed your version of AspNetBufferingTargetWrapper after reading the comments, changed NLogHttpModule to use OnEndRequest again |
Looks like GitHub is happy now, and sees But also need to revert the breaking changes in |
tests/NLog.Web.AspNetCore.Tests/NLogBufferingTargetWrapperMiddlewareTests.cs
Show resolved
Hide resolved
tests/NLog.Web.AspNetCore.Tests/NLogBufferingTargetWrapperMiddlewareTests.cs
Outdated
Show resolved
Hide resolved
good comments, I will work on the unit tests later this week. |
Thank you for pushing me for better unit tests. This did find 2 defects, one in null HttpContext case for NLogHttpModule, one for main success path in the core buffering target. DebugTarget and MemoryTarget were used to verify count of messages, that all all messages were written, and in proper order. A test case of 3 targets each having a memory target was the most complicated, and showed the messages in the proper order. When done with a valid HttpContext, the use of the buffer limit was proven. With a null HttpContext, the proof of skipping the buffer target and writing all messages even above the buffer limit was proven. |
Kudos, SonarCloud Quality Gate passed! |
Think the new test-cases looks great with asserting on the target-output, and not just probing the HttpContext-Items-Dictionary. Unless you have other things you would like to add, then I think it is ready to merge (I will probably make a followup commit to merge the 2 test-classes into one common, and investigate not allocating |
@bakgerman After the merge the total code-coverage moved from 80pct to 84 pct, so nice improvement. I guess the wiki-page needs to be updated, about how to use it with NLog.Web.AspNetCore: https://github.com/NLog/NLog/wiki/AspNetBufferingWrapper-target And maybe also the SandCastle docs: |
Yes, I will update the wiki and SandCastle |
Think we can skip the SandCastle-docs for now, and focus on the wiki-page. Still curious if there are any users waiting for AspNetBufferingTargetWrapper on ASP.NET Core, but I really like the new unit-tests. |
yes I am curious as well, i will focus on the wiki page. |
wiki page is updated |
Excellent. Lets see if anyone will try the new rocket :) |
Resolves #304
HttpContext.Items
during logging (since not threadsafe), and avoid AspNetBufferingTargetWrapper having to know about HttpModule / HttpMiddleware.