aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-08-27 15:56:12 +0000
committerKenny Levinsen <kl@kl.wtf>2020-08-28 01:21:57 +0200
commita254fe3692e63f92aa710310ba8113373180448c (patch)
treee241010ffbfd6f8c3aefd31b270ef4c6bd8b1d59 /common
parentab4b961492ef91a9e2b456b4e2812eaad9994c3a (diff)
Rename enum log_level to libseat_log_level
This is preparatory work for exposing a public function to set libseat's log handler.
Diffstat (limited to 'common')
-rw-r--r--common/log.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/common/log.c b/common/log.c
index 902e870..7e5e8d4 100644
--- a/common/log.c
+++ b/common/log.c
@@ -10,22 +10,22 @@
const long NSEC_PER_SEC = 1000000000;
-static enum log_level current_log_level;
+static enum libseat_log_level current_log_level;
static struct timespec start_time = {-1, -1};
static bool colored = false;
static const char *verbosity_colors[] = {
- [LOGLEVEL_SILENT] = "",
- [LOGLEVEL_ERROR] = "\x1B[1;31m",
- [LOGLEVEL_INFO] = "\x1B[1;34m",
- [LOGLEVEL_DEBUG] = "\x1B[1;90m",
+ [LIBSEAT_LOG_LEVEL_SILENT] = "",
+ [LIBSEAT_LOG_LEVEL_ERROR] = "\x1B[1;31m",
+ [LIBSEAT_LOG_LEVEL_INFO] = "\x1B[1;34m",
+ [LIBSEAT_LOG_LEVEL_DEBUG] = "\x1B[1;90m",
};
static const char *verbosity_headers[] = {
- [LOGLEVEL_SILENT] = "",
- [LOGLEVEL_ERROR] = "[ERROR]",
- [LOGLEVEL_INFO] = "[INFO]",
- [LOGLEVEL_DEBUG] = "[DEBUG]",
+ [LIBSEAT_LOG_LEVEL_SILENT] = "",
+ [LIBSEAT_LOG_LEVEL_ERROR] = "[ERROR]",
+ [LIBSEAT_LOG_LEVEL_INFO] = "[INFO]",
+ [LIBSEAT_LOG_LEVEL_DEBUG] = "[DEBUG]",
};
static void timespec_sub(struct timespec *r, const struct timespec *a, const struct timespec *b) {
@@ -37,7 +37,7 @@ static void timespec_sub(struct timespec *r, const struct timespec *a, const str
}
}
-void log_init(enum log_level level) {
+void log_init(enum libseat_log_level level) {
if (start_time.tv_sec >= 0) {
return;
}
@@ -46,7 +46,7 @@ void log_init(enum log_level level) {
colored = isatty(STDERR_FILENO);
}
-void _logf(enum log_level level, const char *fmt, ...) {
+void _logf(enum libseat_log_level level, const char *fmt, ...) {
int stored_errno = errno;
va_list args;
if (level > current_log_level) {
@@ -56,7 +56,7 @@ void _logf(enum log_level level, const char *fmt, ...) {
struct timespec ts = {0};
clock_gettime(CLOCK_MONOTONIC, &ts);
timespec_sub(&ts, &ts, &start_time);
- unsigned c = (level < LOGLEVEL_LAST) ? level : LOGLEVEL_LAST - 1;
+ unsigned c = (level < LIBSEAT_LOG_LEVEL_LAST) ? level : LIBSEAT_LOG_LEVEL_LAST - 1;
const char *prefix, *postfix;