logging: make libi3 use verboselog()/errorlog(), provide it in each caller

While this is a bit ugly, it makes the log messages end up where they
are supposed to: in the shmlog/stdout in case of i3 and on stdout in
case of utilities such as i3-input
This commit is contained in:
Michael Stapelberg
2012-08-13 13:27:00 +02:00
parent 6c9bf84d4e
commit 2896ae8057
6 changed files with 88 additions and 7 deletions

View File

@ -69,10 +69,12 @@ struct Font {
/* Since this file also gets included by utilities which dont use the i3 log
* infrastructure, we define a fallback. */
#if !defined(LOG)
#define LOG(fmt, ...) fprintf(stdout, "[libi3] " __FILE__ " " fmt, ##__VA_ARGS__)
void verboselog(char *fmt, ...);
#define LOG(fmt, ...) verboselog("[libi3] " __FILE__ " " fmt, ##__VA_ARGS__)
#endif
#if !defined(ELOG)
#define ELOG(fmt, ...) fprintf(stderr, "[libi3] ERROR: " fmt, ##__VA_ARGS__)
void errorlog(char *fmt, ...);
#define ELOG(fmt, ...) errorlog("[libi3] ERROR: " fmt, ##__VA_ARGS__)
#endif
/**