aboutsummaryrefslogtreecommitdiffstats
path: root/include/log.h
diff options
context:
space:
mode:
authorLibravatar Eric Engestrom <eric@engestrom.ch>2016-05-02 15:10:22 +0100
committerLibravatar Eric Engestrom <eric@engestrom.ch>2016-05-02 18:30:04 +0100
commitcc9d1cacbb79ce9a54f2c8505a25f4ace7d74c46 (patch)
treebb62675e504f73e2a1c1f71727256ae5f8e5bfa1 /include/log.h
parentMerge pull request #634 from 1ace/fix/log-double-close (diff)
downloadsway-cc9d1cacbb79ce9a54f2c8505a25f4ace7d74c46.tar.gz
sway-cc9d1cacbb79ce9a54f2c8505a25f4ace7d74c46.tar.zst
sway-cc9d1cacbb79ce9a54f2c8505a25f4ace7d74c46.zip
common: refactor sway_log()
This removes most preprocessor logic, leaving it only it the header.
Diffstat (limited to 'include/log.h')
-rw-r--r--include/log.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/log.h b/include/log.h
index 268783f4..efacf90f 100644
--- a/include/log.h
+++ b/include/log.h
@@ -22,14 +22,14 @@ bool _sway_assert(bool condition, const char* format, ...) __attribute__((format
22#define sway_assert(COND, FMT, ...) \ 22#define sway_assert(COND, FMT, ...) \
23 _sway_assert(COND, "%s:" FMT, __PRETTY_FUNCTION__, ##__VA_ARGS__) 23 _sway_assert(COND, "%s:" FMT, __PRETTY_FUNCTION__, ##__VA_ARGS__)
24 24
25#ifndef NDEBUG
26void _sway_log(const char *filename, int line, log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,4,5))); 25void _sway_log(const char *filename, int line, log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,4,5)));
26
27#ifndef NDEBUG
27#define sway_log(VERBOSITY, FMT, ...) \ 28#define sway_log(VERBOSITY, FMT, ...) \
28 _sway_log(__FILE__, __LINE__, VERBOSITY, FMT, ##__VA_ARGS__) 29 _sway_log(__FILE__, __LINE__, VERBOSITY, FMT, ##__VA_ARGS__)
29#else 30#else
30void _sway_log(log_importance_t verbosity, const char* format, ...) __attribute__((format(printf,2,3)));
31#define sway_log(VERBOSITY, FMT, ...) \ 31#define sway_log(VERBOSITY, FMT, ...) \
32 _sway_log(VERBOSITY, FMT, ##__VA_ARGS__) 32 _sway_log(NULL, 0, VERBOSITY, FMT, ##__VA_ARGS__)
33#endif 33#endif
34 34
35void error_handler(int sig); 35void error_handler(int sig);