aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/log.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/log.c b/common/log.c
index 2acf2e57..483420e7 100644
--- a/common/log.c
+++ b/common/log.c
@@ -45,6 +45,13 @@ static const char *verbosity_colors[] = {
45 [SWAY_DEBUG ] = "\x1B[1;90m", 45 [SWAY_DEBUG ] = "\x1B[1;90m",
46}; 46};
47 47
48static const char *verbosity_headers[] = {
49 [SWAY_SILENT] = "",
50 [SWAY_ERROR] = "[ERROR]",
51 [SWAY_INFO] = "[INFO]",
52 [SWAY_DEBUG] = "[DEBUG]",
53};
54
48static void timespec_sub(struct timespec *r, const struct timespec *a, 55static void timespec_sub(struct timespec *r, const struct timespec *a,
49 const struct timespec *b) { 56 const struct timespec *b) {
50 const long NSEC_PER_SEC = 1000000000; 57 const long NSEC_PER_SEC = 1000000000;
@@ -84,6 +91,8 @@ static void sway_log_stderr(sway_log_importance_t verbosity, const char *fmt,
84 91
85 if (colored && isatty(STDERR_FILENO)) { 92 if (colored && isatty(STDERR_FILENO)) {
86 fprintf(stderr, "%s", verbosity_colors[c]); 93 fprintf(stderr, "%s", verbosity_colors[c]);
94 } else {
95 fprintf(stderr, "%s ", verbosity_headers[c]);
87 } 96 }
88 97
89 vfprintf(stderr, fmt, args); 98 vfprintf(stderr, fmt, args);