aboutsummaryrefslogtreecommitdiffstats
path: root/common/log.c
diff options
context:
space:
mode:
authorLibravatar Jerzi Kaminsky <JerziKaminsky@users.noreply.github.com>2017-04-20 19:13:53 +0300
committerLibravatar Jerzi Kaminsky <JerziKaminsky@users.noreply.github.com>2017-04-20 19:20:40 +0300
commit8ecb49067997c37c006cbc4e4a88c4a13f31fca7 (patch)
tree6f09e8f2374eada5b031c3c1957caafafdfb0250 /common/log.c
parentexplicitly ignore unused return value (diff)
downloadsway-8ecb49067997c37c006cbc4e4a88c4a13f31fca7.tar.gz
sway-8ecb49067997c37c006cbc4e4a88c4a13f31fca7.tar.zst
sway-8ecb49067997c37c006cbc4e4a88c4a13f31fca7.zip
Make sway_abort() report location
Diffstat (limited to 'common/log.c')
-rw-r--r--common/log.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/common/log.c b/common/log.c
index 8e5b71f9..61937495 100644
--- a/common/log.c
+++ b/common/log.c
@@ -53,16 +53,6 @@ void sway_log_colors(int mode) {
53 colored = (mode == 1) ? 1 : 0; 53 colored = (mode == 1) ? 1 : 0;
54} 54}
55 55
56void sway_abort(const char *format, ...) {
57 fprintf(stderr, "ERROR: ");
58 va_list args;
59 va_start(args, format);
60 vfprintf(stderr, format, args);
61 va_end(args);
62 fprintf(stderr, "\n");
63 sway_terminate(EXIT_FAILURE);
64}
65
66void _sway_vlog(const char *filename, int line, log_importance_t verbosity, 56void _sway_vlog(const char *filename, int line, log_importance_t verbosity,
67 const char *format, va_list args) { 57 const char *format, va_list args) {
68 if (verbosity <= v) { 58 if (verbosity <= v) {
@@ -116,6 +106,15 @@ void _sway_log(const char *filename, int line, log_importance_t verbosity, const
116 va_end(args); 106 va_end(args);
117} 107}
118 108
109
110void _sway_abort(const char *filename, int line, const char* format, ...) {
111 va_list args;
112 va_start(args, format);
113 _sway_vlog(filename, line, L_ERROR, format, args);
114 va_end(args);
115 sway_terminate(EXIT_FAILURE);
116}
117
119void sway_log_errno(log_importance_t verbosity, char* format, ...) { 118void sway_log_errno(log_importance_t verbosity, char* format, ...) {
120 if (verbosity <= v) { 119 if (verbosity <= v) {
121 unsigned int c = verbosity; 120 unsigned int c = verbosity;