diff options
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -0,0 +1,16 @@ +#include <stdio.h> +#include <stdarg.h> + +enum plog { PLOG_INFO, PLOG_WARN, PLOG_ERR }; +static const char *msg[] = { "info", "warn", "eror"}; + +void plog(enum plog type, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + fprintf(stderr, "%s: ",msg[type]); + vfprintf(stderr, fmt, args); + putc('\n', stderr); + va_end(args); +} |