Logger severity string parsed for each log message
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 616
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 10
Description
For each log message and logger, Log::~Log() calls Logger::GetMinSeverity():
https://github.com/Icinga/icinga2/blob/d20f3d7c84c23f190f4f4638d4c1be0f07fdf41e/lib/base/logger.cpp#L241
Which in turn calls Logger::StringToSeverity() each time:
https://github.com/Icinga/icinga2/blob/d20f3d7c84c23f190f4f4638d4c1be0f07fdf41e/lib/base/logger.cpp#L88
Which in turn compares the string against all severities each time:
https://github.com/Icinga/icinga2/blob/d20f3d7c84c23f190f4f4638d4c1be0f07fdf41e/lib/base/logger.cpp#L123-L137
Instead, the severity string should be parsed once and then this value should be used.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/base/logger.cpp, following the Log::~Log(), Logger::GetMinSeverity(), and Logger::StringToSeverity() call chain linked in the issue. Confirm where the severity string is repeatedly parsed, then make the parsed value reusable while preserving existing severity behavior. Done means each log message no longer performs the repeated string comparisons.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- observability-sre, performance
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100