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
logger - using ModuleParams #14316
logger - using ModuleParams #14316
Conversation
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.
All of the params require a reboot, so you don't need to check for changes. But it would be good to add it anyway to avoid future surprises. You need to subscribe to parameter_update
and call updateParams();
if it changes.
src/modules/logger/logger.cpp
Outdated
@@ -268,7 +266,11 @@ Logger *Logger::instantiate(int argc, char *argv[]) | |||
break; | |||
|
|||
case 'e': | |||
log_on_start = true; | |||
log_mode = Logger::LogMode::boot_until_disarm; |
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 will not be correct if -f -e
is specified. This is why the logic is as it is now.
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.
@bkueng, thanks again. but I think you wrong here. this is exactly what I wanted to fix here, the confusion.
as default log_on_start = false; log_until_shutdown = false;
-e set log_on_start = true;
-f set log_on_start = true; log_until_shutdown = true;
later:
if (log_on_start) {
if (log_until_shutdown) { log_mode = Logger::LogMode::boot_until_shutdown;
} else { log_mode = Logger::LogMode::boot_until_disarm;}}
any chance you ment if -f -e
are both specified? that can't be
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.
Yes I meant if both are specified, which is valid and correct (-f
implies -e
).
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.
@bkueng - to be clear, there is no fix required here? its all good, and more clear now, right?
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, it's incorrect now. Please revert back to how it was.
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.
@bkueng It took me some time to understand you. I see now what you meant. My thought is that its either using -e or -f or -x. and not some kind of combinations.
on the previous algorithm using '-f' or '-f -e' or '-e -f' did the exact some thing.
On my "way" you should use only one of them.
yes, it breaks something on current confusing use.
is there way to enforce it, you must call with one of the argument only?
And I don't talk about how -x confuse the current logic....
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.
From a CLI perspective this is not confusing, it's clearly documented that -f imples -e.
Only in code there's a bit more logic to handle this. I don't see a problem with this.
Changing the CLI is an option, but then you must return an error if both are provided - the end result won't really be simpler.
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.
@bkueng - I can't say that I am 100% agree, but I have changed to logic according to your recommendation on this commit
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.
After some rebasing issue... Ready to re-review
that done, can you review? |
and some cleanups on main()
Fixed parameters type
Added update_params, to enable runtime parameters changes
calling to update parameters to different location, to reduce delay between polling and topic readout
34077d8
to
ac6640c
Compare
and some cleanups on main()
Describe problem solved by this pull request
using ModuleParams in logger module.
@dagar can you confirm/fixme if while using ModuleParams should I call ModuleParams::updateParams() somewhere?