diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-11-11 08:32:32 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-11-11 08:32:32 -0500 |
commit | d729032ba2e8da8b4efa4b3112231662c6912f98 (patch) | |
tree | 18da4d079539dcc53bf15b5a967b448ac1d5082c /include | |
parent | Add some documentation comments (diff) | |
download | sway-d729032ba2e8da8b4efa4b3112231662c6912f98.tar.gz sway-d729032ba2e8da8b4efa4b3112231662c6912f98.tar.zst sway-d729032ba2e8da8b4efa4b3112231662c6912f98.zip |
Add file and line number to log in Debug build
Diffstat (limited to 'include')
-rw-r--r-- | include/log.h | 11 |
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. |
17 | bool toggle_debug_logging(void); | 17 | bool toggle_debug_logging(void); |
18 | void sway_log_colors(int mode); | 18 | void sway_log_colors(int mode); |
19 | void sway_log(log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,2,3))); | ||
20 | void sway_log_errno(log_importance_t verbosity, char* format, ...) __attribute__((format(printf,2,3))); | 19 | void sway_log_errno(log_importance_t verbosity, char* format, ...) __attribute__((format(printf,2,3))); |
21 | void sway_abort(const char* format, ...) __attribute__((format(printf,1,2))); | 20 | void 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 | ||
27 | void _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 | ||
31 | void _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 | |||
27 | void error_handler(int sig); | 36 | void error_handler(int sig); |
28 | 37 | ||
29 | void layout_log(const swayc_t *c, int depth); | 38 | void layout_log(const swayc_t *c, int depth); |