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

Consistent use of colors for warning and error msgs in spawner #974

Merged
merged 2 commits into from
Mar 21, 2023

Conversation

bijoua29
Copy link
Contributor

@bijoua29 bijoua29 commented Mar 20, 2023

For consistency, fix some error and warning log messages to use corresponding color

Copy link
Member

@aprotyas aprotyas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These LGTM but at this point I'm wondering whether it makes sense to introduce error/warn logging wrappers rather than include color strings in every invocation?

Something like:

def _colored_string(to_log, color):
    return color + to_log + bcolors.ENDC

def log_error(node, to_log):
    node.get_logger.error(_colored_string(to_log, bcolors.FAIL))

def log_warn(node, to_log):
    node.get_logger.warn(_colored_string(to_log, bcolors.WARNING))

@bijoua29
Copy link
Contributor Author

These LGTM but at this point I'm wondering whether it makes sense to introduce error/warn logging wrappers rather than include color strings in every invocation?

Something like:

def _colored_string(to_log, color):
    return color + to_log + bcolors.ENDC

def log_error(node, to_log):
    node.get_logger.error(_colored_string(to_log, bcolors.FAIL))

def log_warn(node, to_log):
    node.get_logger.warn(_colored_string(to_log, bcolors.WARNING))

That's a good idea. Maybe do this in another PR?

@bmagyar bmagyar merged commit 7ed3786 into ros-controls:master Mar 21, 2023
1 check passed
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

3 participants