-
Notifications
You must be signed in to change notification settings - Fork 584
Fix Logger Severity String Parse #9629
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
base: master
Are you sure you want to change the base?
Fix Logger Severity String Parse #9629
Conversation
parsed severity string is cached as an optional variable. so parsing would be called only once for each logger. refs: Icinga#9534
Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA). Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA. After that, please reply here with a comment and we'll verify. Contributors that have not signed yet: @sreyhani
|
signed the CLA |
@cla-bot check |
Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA). Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA. After that, please reply here with a comment and we'll verify. Contributors that have not signed yet: @sreyhani
|
@@ -202,7 +211,7 @@ bool Logger::IsTimestampEnabled() | |||
void Logger::SetSeverity(const String& value, bool suppress_events, const Value& cookie) |
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.
Can we add function description as well ?
@cla-bot check |
Is the function called that often? |
it is called for each Log message * number of loggers I don't know if that's really high number or not. just wanted to fix the related issue |
At the end of the day you only changed GetMinSeverity which is only called here in UpdateMinLogSeverity which is only called in |
GetMinSeverity is also called in ~Log here |
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.
Anyway I prefer #9534 (comment) and would wait whether that suggestion's author will do that.
@@ -202,7 +211,7 @@ bool Logger::IsTimestampEnabled() | |||
void Logger::SetSeverity(const String& value, bool suppress_events, const Value& cookie) | |||
{ | |||
ObjectImpl<Logger>::SetSeverity(value, suppress_events, cookie); | |||
|
|||
min_severity.emplace(StringToSeverity(value)); |
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.
What happens...
|
||
return ls; | ||
} catch (const std::exception &) { /* use the default level */ } | ||
min_severity.emplace(ls); |
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.
... in case of an exception?
parsed severity string is cached as an optional variable. so parsing would be called only once for each logger.
fixes #9534