-
Notifications
You must be signed in to change notification settings - Fork 765
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
Logs: Support parsing State & Scopes and capture of formatted Message #1869
Logs: Support parsing State & Scopes and capture of formatted Message #1869
Conversation
@@ -37,19 +38,29 @@ internal OpenTelemetryLogger(string categoryName, OpenTelemetryLoggerProvider pr | |||
|
|||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter) | |||
{ | |||
if (!this.IsEnabled(logLevel)) | |||
if (!this.IsEnabled(logLevel) || Sdk.SuppressInstrumentation) |
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.
No strong opinion - my personal preference would be splitting this into two "if" statements. In this way it is easier to put breakpoint on the selected return statement instead of putting a condition-breakpoint (which is much slower since it uses debugger expression-evaluation engine).
if (condition1)
{
return;
}
if (condition2)
{
return;
}
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.
LGTM.
Codecov Report
@@ Coverage Diff @@
## main #1869 +/- ##
==========================================
- Coverage 83.77% 83.35% -0.43%
==========================================
Files 187 189 +2
Lines 5967 6128 +161
==========================================
+ Hits 4999 5108 +109
- Misses 968 1020 +52
|
/// <summary> | ||
/// Gets or sets a value indicating whether or not log message should be included on generated <see cref="LogRecord"/>s. Default value: False. | ||
/// </summary> | ||
public bool IncludeMessage { get; set; } |
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.
public bool IncludeMessage { get; set; } | |
public bool IncludeFormattedMessage { get; set; } |
I think IncludeFormattedMessage is a better name.
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.
Sounds good. What about LogRecord.Message
you want that to be LogRecord.FormattedMessage
or leave as LogRecord.Message
?
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.
Thanks!
Left couple of small non blocking comments.
We can iterate on this as needed. (and add Unit tests)
Fixes #1834
Changes
[Originally part of #1833 but @cijothomas requested that it be split up.]
LogRecord
Public API
TODOs
CHANGELOG.md
updated for non-trivial changes