diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-07-09 16:12:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-09 16:12:20 -0700 |
commit | 2518de655c7278728736d22549656c639e4c92f0 (patch) | |
tree | acd08ceb9709eb25541fa02fbc533a7c6a99dbad /util | |
parent | e78d72f42e10b43a76ef5ba6b8c4b3b470b25245 (diff) | |
parent | 7cbef152063e1fbb24e6204339ff4587a74be04b (diff) |
Merge pull request #1126 from emersion/wlr-log-prefix
util: add wlr_ prefix to log symbols
Diffstat (limited to 'util')
-rw-r--r-- | util/log.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -9,16 +9,16 @@ #include <wlr/util/log.h> static bool colored = true; -static log_importance_t log_importance = L_ERROR; +static enum wlr_log_importance log_importance = WLR_ERROR; static const char *verbosity_colors[] = { - [L_SILENT] = "", - [L_ERROR ] = "\x1B[1;31m", - [L_INFO ] = "\x1B[1;34m", - [L_DEBUG ] = "\x1B[1;30m", + [WLR_SILENT] = "", + [WLR_ERROR ] = "\x1B[1;31m", + [WLR_INFO ] = "\x1B[1;34m", + [WLR_DEBUG ] = "\x1B[1;30m", }; -static void log_stderr(log_importance_t verbosity, const char *fmt, +static void log_stderr(enum wlr_log_importance verbosity, const char *fmt, va_list args) { if (verbosity > log_importance) { return; @@ -33,7 +33,7 @@ static void log_stderr(log_importance_t verbosity, const char *fmt, strftime(buffer, sizeof(buffer), "%F %T - ", tm_info); fprintf(stderr, "%s", buffer); - unsigned c = (verbosity < L_LAST) ? verbosity : L_LAST - 1; + unsigned c = (verbosity < WLR_LOG_IMPORTANCE_LAST) ? verbosity : WLR_LOG_IMPORTANCE_LAST - 1; if (colored && isatty(STDERR_FILENO)) { fprintf(stderr, "%s", verbosity_colors[c]); @@ -47,10 +47,10 @@ static void log_stderr(log_importance_t verbosity, const char *fmt, fprintf(stderr, "\n"); } -static log_callback_t log_callback = log_stderr; +static wlr_log_func_t log_callback = log_stderr; -void wlr_log_init(log_importance_t verbosity, log_callback_t callback) { - if (verbosity < L_LAST) { +void wlr_log_init(enum wlr_log_importance verbosity, wlr_log_func_t callback) { + if (verbosity < WLR_LOG_IMPORTANCE_LAST) { log_importance = verbosity; } if (callback) { @@ -58,11 +58,11 @@ void wlr_log_init(log_importance_t verbosity, log_callback_t callback) { } } -void _wlr_vlog(log_importance_t verbosity, const char *fmt, va_list args) { +void _wlr_vlog(enum wlr_log_importance verbosity, const char *fmt, va_list args) { log_callback(verbosity, fmt, args); } -void _wlr_log(log_importance_t verbosity, const char *fmt, ...) { +void _wlr_log(enum wlr_log_importance verbosity, const char *fmt, ...) { va_list args; va_start(args, fmt); log_callback(verbosity, fmt, args); @@ -74,7 +74,7 @@ void _wlr_log(log_importance_t verbosity, const char *fmt, ...) { // e.g. '/src/build/wlroots/backend/wayland/backend.c' and // '../backend/wayland/backend.c' will both be stripped to // 'backend/wayland/backend.c' -const char *wlr_strip_path(const char *filepath) { +const char *_wlr_strip_path(const char *filepath) { static int srclen = sizeof(WLR_SRC_DIR); if (strstr(filepath, WLR_SRC_DIR) == filepath) { filepath += srclen; |