-
Notifications
You must be signed in to change notification settings - Fork 3
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
Enhance message output #32
Comments
what about Also do we have to ouput errors to stderr? |
Sure thing about this.
I think we can have a wrapper/lib around message/output handling. This is particularly useful when trying to debug and you need extended output. So I'm thinking on a logging library, probably there's one out there that fits our needs. |
Well, i think enums and a simple function could do, so I do not see the benefit of a logging library. |
enum ZPM_MSG_TYPE {
ZPM_MSG,
ZPM_ERR,
ZPM_NONE
};
void zpm_msg(enum ZPM_MSG_TYPE type, const char* format, ...) {
char msg[PATH_MAX];
FILE* f = type = ZPM_ERR ? stderr : stdout;
va_list arg;
va_start(arg, fmt);
vsnprintf(msg, 256, fmt, arg);
if (type != ZPM_NONE) {
fprintf(f, "[ZPM] ");
}
fprintf(f, "%s\n", msg);
va_end(arg);
} Do we need coloration? I'd quite like that. if (type != ZPM_NONE {
int color = type == ZPM_ERR : 31 : 32;
fprintf(f, "\033[1m[\033[0m\033[%imZPM\033[0m\033[1m]\033[0m", color);
} also printf("\033[1m%s\033[0m", plugin_name); in |
Well, having different error levels (debug, info, error, etc) would be nice. If we can have that in a couple of lines it's welcome! :D |
Would you like me to give it a try based on what I posted before (thus renaming ZPM_NONE to ZPM_INFO) ? |
Yeah sure, it will be great to tell
|
We migth need to make color optionnal, maybe depending on wther or not it is running in a pipe, as it mess with cram. |
Yep a |
I have trouble finding info on |
see #33. |
Related Trello card: https://trello.com/c/fZHPQp8q/9-fancy-output
Probably [ZPM] to start every line except for list. Maybe green for standard message and red for error. Also plugin name should be bold.
The text was updated successfully, but these errors were encountered: