aboutsummaryrefslogtreecommitdiffstats
path: root/include/log.h
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-11-11 08:32:32 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-11-11 08:32:32 -0500
commitd729032ba2e8da8b4efa4b3112231662c6912f98 (patch)
tree18da4d079539dcc53bf15b5a967b448ac1d5082c /include/log.h
parentAdd some documentation comments (diff)
downloadsway-d729032ba2e8da8b4efa4b3112231662c6912f98.tar.gz
sway-d729032ba2e8da8b4efa4b3112231662c6912f98.tar.zst
sway-d729032ba2e8da8b4efa4b3112231662c6912f98.zip
Add file and line number to log in Debug build
Diffstat (limited to 'include/log.h')
-rw-r--r--include/log.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/log.h b/include/log.h
index 4b769c93..eada025e 100644
--- a/include/log.h
+++ b/include/log.h
@@ -16,7 +16,6 @@ void reset_log_level(void);
16// returns whether debug logging is on after switching. 16// returns whether debug logging is on after switching.
17bool toggle_debug_logging(void); 17bool toggle_debug_logging(void);
18void sway_log_colors(int mode); 18void sway_log_colors(int mode);
19void sway_log(log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,2,3)));
20void sway_log_errno(log_importance_t verbosity, char* format, ...) __attribute__((format(printf,2,3))); 19void sway_log_errno(log_importance_t verbosity, char* format, ...) __attribute__((format(printf,2,3)));
21void sway_abort(const char* format, ...) __attribute__((format(printf,1,2))); 20void sway_abort(const char* format, ...) __attribute__((format(printf,1,2)));
22 21
@@ -24,6 +23,16 @@ bool _sway_assert(bool condition, const char* format, ...) __attribute__((format
24#define sway_assert(COND, FMT, ...) \ 23#define sway_assert(COND, FMT, ...) \
25 _sway_assert(COND, "%s:" FMT, __PRETTY_FUNCTION__, ##__VA_ARGS__) 24 _sway_assert(COND, "%s:" FMT, __PRETTY_FUNCTION__, ##__VA_ARGS__)
26 25
26#ifndef NDEBUG
27void _sway_log(const char *filename, int line, log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,4,5)));
28#define sway_log(VERBOSITY, FMT, ...) \
29 _sway_log(__FILE__, __LINE__, VERBOSITY, FMT, ##__VA_ARGS__)
30#else
31void _sway_log(log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,2,3)));
32#define sway_log(VERBOSITY, FMT, ...) \
33 _sway_log(VERBOSITY, FMT, ##__VA_ARGS__)
34#endif
35
27void error_handler(int sig); 36void error_handler(int sig);
28 37
29void layout_log(const swayc_t *c, int depth); 38void layout_log(const swayc_t *c, int depth);