Skip to content

Conversation

@sgunes-wirepas
Copy link
Contributor

@sgunes-wirepas sgunes-wirepas commented May 9, 2025

No description provided.

}
}

int Platform_set_log_level(const int level)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know what was the spec for this modification. But I'd like that this dynamic log level could target one file only. Increasing the level to Debug for all modules will generate too much unwanted logs.
And this level should also be saved, so that on reset, it restarts with the requested log level. Init phase logs are very important.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be a much bigger change as log system do not really have semantic for module id for now. Each file select its own log prefix.
But for sure it would be nice, even if at run time it could be hard to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was mainly for the linux gateway to help with testing. In linux gateway sink service the log level can be set in the beginning of the main function based on an environment variable. I agree there are too many logs when debug is selected. I was thinking about adding a new "trace" level and move some of the logs to use that.

I think module level granularity becomes difficult because of the configuration part. Would we need some configuration file to define all the levels for each module? There's the zlog library that looks like it has module("category") specific level selection out of the box, but I don't know if it would be worth taking something like that into use?

@sgunes-wirepas sgunes-wirepas force-pushed the feature/dynamic_log_level branch 2 times, most recently from 319c005 to 53ccf10 Compare June 18, 2025 12:18
This change introduces runtime log level selection globally or per
logging module. Applications can use Platform_set_log_level or
Platform_set_module_log_level functions to set log levels during
runtime.

Each logging module uses a pointer to the log level managed by the
platform implementation to minimize runtime checks.

It is possible to define the NO_BUILD_ALL_LOG_LEVELS parameter to
prevent building of logging functions with higher levels than the
MAX_LOG_LEVEL parameter, like before.
@sgunes-wirepas sgunes-wirepas force-pushed the feature/dynamic_log_level branch from b2292b6 to fc3f87b Compare September 16, 2025 13:24
@sgunes-wirepas sgunes-wirepas merged commit b70b379 into master Sep 17, 2025
5 checks passed
@sgunes-wirepas sgunes-wirepas deleted the feature/dynamic_log_level branch September 17, 2025 08:15
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.

4 participants