Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- it can be improved. Here's my version:
- log_error = 1;
- log_debug = 0;
- #define LOG_PRINT(_log_level, _type, _fmt, _args...) do {
- if ((_log_level))
- warnx("%lld " _type _fmt,
- tick_diff_secs(rel_time, rdtsc()), ##_args);
- } while(0)
- #define ERR_PRINT(fmt, args...)
- LOG_PRINT(log_error,"ERROR: ", fmt, ##args)
- #define DBG_PRINT(fmt, args...)
- LOG_PRINT(log_debug, "DEBUG: ", fmt, ##args)
- /* */
- ERR_PRINT("%d", some_int_var);
- DBG_PRINT("%d", some_int_var); // goes silent bcz log_debug = 0
Advertisement
Add Comment
Please, Sign In to add comment