-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
StackTraceLayoutRenderer with Raw format should display source FileName #2075
StackTraceLayoutRenderer with Raw format should display source FileName #2075
Conversation
5398185
to
d05cc33
Compare
Codecov Report
@@ Coverage Diff @@
## master #2075 +/- ##
=======================================
- Coverage 81% 81% -<1%
=======================================
Files 289 289
Lines 19908 19908
Branches 2353 2354 +1
=======================================
- Hits 16204 16190 -14
- Misses 3105 3118 +13
- Partials 599 600 +1 |
e586d50
to
804a36e
Compare
|
||
RenderMe("I am:"); | ||
|
||
AssertDebugLastMessageContains("debug", "RenderStackTrace_RawWithSource at offset "); |
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.
not sure if this a useful test now. It can be still file:line:column <filename unknown>:0:0
?
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.
Well it is combination of the 3 asserts, that all verifies the same last logged message. See the original RenderStackTrace_Raw, which does the same.
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.
yeah but should we not test that line number >0 ?
Need a regex I guess
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.
Well it is enough for me that it was able to capture the filename (StackTraceRendererTests.cs). Not wanting to dive into the StackTrace-formating abyss.
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.
something like this?
string pattern = @"<(?<filename>.*?)>:(?<line>\d+):(?<col>\d+)";
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.
I'm not committing any regex funkyness. Just close this PR, and create you own :)
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.
am I allowed to push on this branch? (dunno where I can see that, it's a github option)
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.
"Allow edits from maintainers" is checked, so I guess you can knock yourself wild :)
/// <summary> | ||
/// Raw format (multiline with source info - as returned by StackFrame.ToString() method). | ||
/// </summary> | ||
RawWithSource, |
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.
I'm doubting if we should patch raw
instead of a new option (I know i proposed it earlier ;))
Printing file:line:column <filename unknown>:0:0
sounds useless to me and the default is flat
.
What do you think?
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.
I'm not using this LayoutRenderer, so fixing the existing Raw-format is fine with me. Just give a shout, and I will remove RawWithSource and fix Raw.
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.
I think fix "raw" is more clear :)
So remove and we need to document the change in Nlog 4.4.7.
Thanks! I was thinking to create this, but you we're faster :) |
d6e7ed1
to
ba09168
Compare
ba09168
to
42fc955
Compare
…rce FileName and LineNumber
42fc955
to
999e4eb
Compare
AssertDebugLastMessageContains("debug", "<filename unknown>"); | ||
|
||
#if !MONO | ||
AssertDebugLastMessageContains("debug", "StackTraceRendererTests.cs"); |
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.
👍
updated docs for this: https://github.com/NLog/NLog/wiki/Stack-Trace-Layout-Renderer |
Attempt to fix #2074