Skip to content

sys/log: Improve the console log level indication #3470

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

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

apc067
Copy link
Contributor

@apc067 apc067 commented Jul 17, 2025

Added the option to configure the string & color of MODLOG levels in the console printout from sysconfig; also made text highlighting attribute (for system log modules & highlighted log levels) configurable.

Since the maximum MODLOG level is often being used to ensure unconditional logging, it too received its own configuration support.

Copy link
Contributor

@kasjer kasjer left a comment

Choose a reason for hiding this comment

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

datarec is not a concept known to mynewt-core

@apc067 apc067 force-pushed the peterc/handle-max-log-level branch 2 times, most recently from d5f0b43 to 7de6d49 Compare July 17, 2025 22:32
@apc067
Copy link
Contributor Author

apc067 commented Jul 17, 2025

datarec is not a concept known to mynewt-core

Yes, good point - commit message corrected.

@apc067 apc067 requested a review from kasjer July 17, 2025 22:33
@apc067 apc067 force-pushed the peterc/handle-max-log-level branch from 7de6d49 to 11e9837 Compare July 17, 2025 23:21
Copy link
Contributor

@kasjer kasjer left a comment

Choose a reason for hiding this comment

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

If you have time, you could consider adding colors to syscfg for people with different test.
Name 'MAX' could also be configurable as I assume that in your case it mean something specific and it just happen that LOG_LEVEL_MAX was chosen.

@sjanc
Copy link
Contributor

sjanc commented Jul 22, 2025

While clang format is not perfect and gives sometime strange output, overall it should be taken into account for obvious fixes

here eg. LOG_LEVEL_STR() abomination can be ignored but others (eg comments indent) should be taken into account.

We need to move slowly towards coherent style enforced by clangd format..

};

static int real_log_levels = ARRAY_SIZE(log_level_str) - 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

lets make this const (it is compile-time const anyway)

@apc067
Copy link
Contributor Author

apc067 commented Jul 22, 2025

If you have time, you could consider adding colors to syscfg for people with different test. Name 'MAX' could also be configurable as I assume that in your case it mean something specific and it just happen that LOG_LEVEL_MAX was chosen.

That's a good idea; will implement it under this PR.

@apc067
Copy link
Contributor Author

apc067 commented Jul 22, 2025

While clang format is not perfect and gives sometime strange output, overall it should be taken into account for obvious fixes

here eg. LOG_LEVEL_STR() abomination can be ignored but others (eg comments indent) should be taken into account.

We need to move slowly towards coherent style enforced by clangd format..

Will fix the comment indent. As for the LOG_LEVEL_STR() butchery, it looks visually amazing - could be sold as a post-modernist poem. :-)

Added the option to configure the string & color of MODLOG levels in the
console printout from sysconfig; also made text highlighting attribute
(for system log modules & highlighted log levels) configurable.

Since the maximum MODLOG level is often being used to ensure
unconditional logging, it too received its own configuration support.
@apc067 apc067 force-pushed the peterc/handle-max-log-level branch from 11e9837 to 9337f95 Compare July 23, 2025 22:11
@github-actions github-actions bot added size/m and removed size/s labels Jul 23, 2025
@apc067 apc067 changed the title sys/log: Add string & color to max log level sys/log: Improve the console log level indication Jul 23, 2025
@sjanc sjanc merged commit 65eb174 into apache:master Jul 24, 2025
21 of 22 checks passed
@apc067 apc067 deleted the peterc/handle-max-log-level branch July 31, 2025 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants