-
Notifications
You must be signed in to change notification settings - Fork 94
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
MINIFICPP-2502 Add processorBulletins C2 metric node to FlowInformation #1920
base: MINIFICPP-2512
Are you sure you want to change the base?
Conversation
032cc42
to
90baa4e
Compare
@@ -109,6 +140,7 @@ class LoggerBase : public Logger { | |||
|
|||
private: | |||
std::atomic<int> max_log_size_{LOG_BUFFER_SIZE}; | |||
std::vector<std::function<void(LOG_LEVEL level, const std::string&)>> log_callbacks_; |
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.
do we need multiple callbacks? If not, I'd say keep it simple and only have one.
inline std::string mapLogLevelToString(LOG_LEVEL level) { | ||
switch (level) { | ||
case trace: return "TRACE"; | ||
case debug: return "DEBUG"; | ||
case info: return "INFO"; | ||
case warn: return "WARN"; | ||
case err: return "ERROR"; | ||
case critical: return "CRITICAL"; | ||
case off: return "OFF"; | ||
} | ||
throw std::invalid_argument(fmt::format("Invalid LOG_LEVEL {}", magic_enum::enum_underlying(level))); | ||
} | ||
|
||
inline LOG_LEVEL mapStringToLogLevel(const std::string& level_str) { | ||
if (level_str == "TRACE") { | ||
return trace; | ||
} else if (level_str == "DEBUG") { | ||
return debug; | ||
} else if (level_str == "INFO") { | ||
return info; | ||
} else if (level_str == "WARN") { | ||
return warn; | ||
} else if (level_str == "ERROR") { | ||
return err; | ||
} else if (level_str == "CRITICAL") { | ||
return critical; | ||
} | ||
throw std::invalid_argument(fmt::format("Invalid LOG_LEVEL {}", level_str)); | ||
} |
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.
This mapping is already defined elsewhere, check LogUtils.h (and maybe rename it if you have a better idea)
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.
As I checked LogUtils.h only contains mappings for the enum class LogLevelOption
, but not for the enum LOG_LEVEL
. As I remember we had a brief discussion about standardizing log level representation last year as we have different log level representations in different classes all around the project, but that should be done in a separate PR.
auto message = stringify(std::move(fmt), map_args(std::forward<Args>(args))...); | ||
log_string(level, 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.
why this change? it pessimizes the code by forcing another copy
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 a previous iteration it was used in multiple functions, it was left this way by mistake after it was changed, fixed in 37c777f
4d5fc3d
to
bf3e783
Compare
90baa4e
to
1e8a70d
Compare
1e8a70d
to
5c4804e
Compare
https://issues.apache.org/jira/browse/MINIFICPP-2502
Depends on #1918
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically main)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.