From 7cbef152063e1fbb24e6204339ff4587a74be04b Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 9 Jul 2018 22:49:54 +0100 Subject: util: add wlr_ prefix to log symbols --- util/log.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'util') diff --git a/util/log.c b/util/log.c index 328532f7..754ccfa9 100644 --- a/util/log.c +++ b/util/log.c @@ -9,16 +9,16 @@ #include 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; -- cgit v1.2.3