Repository navigation
Unified logging API (mg_log2) to simplify logging integration #3535
Closed
kjonak
started this conversation in
Feature requests
Replies: 1 comment
|
Thank you, not interested. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Unified logging API (mg_log2) to simplify logging integration
Problem
Current Mongoose logging architecture is based on a combination of:
MG_LOG()macromg_log_prefix(int level, const char *file, int line, const char *fname)mg_log(const char *fmt, ...)mg_vxprintf()This results in a two-stage logging flow (prefix + message) and a stream-based backend.
While this design is flexible, it introduces integration complexity for external logging systems.
Motivation
In some applications it might be beneficial to be able to override it so i t will be:
The current design requires either:
mg_log_set_fn)There is a commented-out function in the codebase:
// bool mg_log2(int ll, const char *file, int line, const char *fmt, ...);This suggests a possible intention for a unified logging API.
Key idea
Maintain full backward compatibility by keeping the existing logging API unchanged by default. Any new behavior should be optional and enabled explicitly via
#ifdefor similar compile-time flags, so existing users are not affected.Introduce an optional unified logging path where a single function call is responsible for each log event, removing the need for a separate prefix stage and stream-based output handling, while allowing backend redirection through a clean and consistent interface.
All reactions