Skip to content

Update MSG macro and create MSG_ONCE macro #411

@ATrivialAtomic

Description

@ATrivialAtomic

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__)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions