Skip to content
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

Merged
merged 5 commits into from Mar 13, 2020
Merged

logger - using ModuleParams #14316

merged 5 commits into from Mar 13, 2020

Conversation

BazookaJoe1900
Copy link
Member

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?

Copy link
Member

@bkueng bkueng left a 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.h Outdated Show resolved Hide resolved
src/modules/logger/logger.h Outdated Show resolved Hide resolved
@@ -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;
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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).

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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....

Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member Author

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

@BazookaJoe1900
Copy link
Member Author

@bkueng

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.

that done, can you review?

src/modules/logger/logger.cpp Outdated Show resolved Hide resolved
src/modules/logger/logger.cpp Outdated Show resolved Hide resolved
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
@bkueng bkueng merged commit 5e343b1 into master Mar 13, 2020
@bkueng bkueng deleted the pr-logger_module_params branch March 13, 2020 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants