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

Gardena/lw/logging #748

Closed

Conversation

LukasWoodtli
Copy link
Contributor

Improve logging functionality:

  • introduce log levels (severity)
  • make max. log level selectable at compile time
  • add log handler that can be customized
  • clean up

Out of scope / do later:

  • replace old logging entries with new macros
  • put logging related code in own header file

@LukasWoodtli LukasWoodtli force-pushed the gardena/lw/logging branch 3 times, most recently from dc97069 to 9306adf Compare January 29, 2024 10:26
All the logging used "\r\n" as line ending characters.
This is kept for Windows but it is changed to "\n" on
all other systems.
The tests check if the expected output for logging is produced.
Some string format specifiers need adjustments for modern C.
The handler function defines how the log messages are formatted.
It can be used for future customization.
The custom handler function can be used to overwrite the defalut log
message handler.
It is used to format the message and to define where it is written to.
Also filtering can be applied.
Additional macros are now used to allow to log to a specific level.
The default log level is 'debug'.
The macros for logging URI's is simplified and improved.
The logging level can now be set with a proprocessor define at
compile time. This helps to reduce the amount of logging messages
that are present in the final binary.
There was some unnecessary macro magic with token concatenation.
There are also legacy logging macros (without a log level) that are
grouped together in the code for better readability.
A function is provided that converts an URI to a string. This string
can be provided as argument to other available logging functions.
The default logging macros (`LOG_DBG` and related) allow now the use
of arguments. The support is limited to the case, when the format
string is a literal. This is due to limitations __VA_ARGS__ in C11.
The important logging functionality was docummented.
The changed code was reformatted with `git clang-format`.
A function was introduced for the logging text formatting to reduce
the memory footprint.
@LukasWoodtli
Copy link
Contributor Author

Check this instead #766

@LukasWoodtli
Copy link
Contributor Author

Superseeded by #766

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

1 participant