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

Feature request: logger TAG and colors #67

Open
abqjln opened this issue Oct 7, 2024 · 0 comments
Open

Feature request: logger TAG and colors #67

abqjln opened this issue Oct 7, 2024 · 0 comments

Comments

@abqjln
Copy link
Contributor

abqjln commented Oct 7, 2024

Digging deep into this great library. Two logging mods I've been manually making might be broadly useful.

  1. Replace TAG definitions with hardcoded source filename.c with func. The functions have the file name embedded so logging their name gives more specific info and still the source file info.

  2. Would it be possible to set colors depending on the log level. That way ERROR, WARN, DEBUG, and INFO would stand out in the stream. I am doing this manually so it works with Windows ssh terminals and gcc.

e.g.,
#define LOG_NRM "\x1B[0m"
#define LOG_ YEL "\x1B[33m"
#define LOG_RED "\x1B[31m"
#define LOG_GRN "\x1B[32m"
#define LOG_BLU "\x1B[34m"
#define LOG_MAG "\x1B[35m"
#define LOG_CYN "\x1B[36m"
#define LOG_WHT "\x1B[37m"

#define LOG_ERROR LOG_RED

These would be prepended and postpended to the format statement. Color could be specified redefining:

log_set_level(LogLevel(level, ERROR_COLOR, DEBUG_COLOR, WARN_COLOR, INFO_COLOR );
Thanks.

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

No branches or pull requests

1 participant