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

Update MSG macro and create MSG_ONCE macro #411

Open
ATrivialAtomic opened this issue Sep 12, 2024 · 0 comments
Open

Update MSG macro and create MSG_ONCE macro #411

ATrivialAtomic opened this issue Sep 12, 2024 · 0 comments

Comments

@ATrivialAtomic
Copy link

Hi there!

Would it be possible to update the #define MSG macro in debug.h to add a space after "%s"? Without the space, you have to add a space at the head of your fmt message to provide separation between MOD_NAME and that message.

Also, more of a personal/syntax question -- should a "\n" be included at the tail of the fmt line ("%s " fmt "\n") to automatically append a newline without having to manually do it with each message? Would that be better served with a new macro that specifies a newline will be added?

Current MSG implementation:

#define MSG(l, fmt, ...) \
        log_msg(LOG_LEVEL_##l, "%s" fmt, MOD_NAME, ##__VA_ARGS__)

Proposed change:

#define MSG(l, fmt, ...) \
        log_msg(LOG_LEVEL_##l, "%s " fmt "\n", MOD_NAME, ##__VA_ARGS__)

Also, in keeping with moving towards preference for MSG, would it be possible to create a similar macro for log_msg_once?

Proposed MSG_ONCE implementation:

#define MSG_ONCE(l, id, fmt, ...) \
        log_msg_once(LOG_LEVEL_##l, id, "%s " fmt "\n", MOD_NAME, ##__VA_ARGS__)
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