]>
Commit | Line | Data |
---|---|---|
5899f3b7 LP |
1 | /*-*- Mode: C; c-basic-offset: 8 -*-*/ |
2 | ||
3 | #ifdef HAVE_CONFIG_H | |
4 | #include <config.h> | |
5 | #endif | |
6 | ||
7 | #include <stdarg.h> | |
8 | #include <stdio.h> | |
9 | ||
10 | #include "log.h" | |
11 | ||
12 | void log_meta( | |
13 | int level, | |
14 | const char*file, | |
15 | int line, | |
16 | const char *func, | |
17 | const char *format, ...) { | |
18 | ||
19 | const char *prefix, *suffix; | |
20 | va_list ap; | |
21 | ||
22 | if (LOG_PRI(level) <= LOG_ERR) { | |
23 | prefix = "\x1B[1;31m"; | |
24 | suffix = "\x1B[0m"; | |
25 | } else { | |
26 | prefix = ""; | |
27 | suffix = ""; | |
28 | } | |
29 | ||
30 | va_start(ap, format); | |
31 | ||
32 | fprintf(stderr, "(%s:%u) %s", file, line, prefix); | |
33 | vfprintf(stderr, format, ap); | |
34 | fprintf(stderr, "%s\n", suffix); | |
35 | ||
36 | va_end(ap); | |
37 | ||
38 | } |