summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_log.h
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-01-23 19:56:03 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-01-23 19:56:03 +0300
commitde532922d9ab42aa15b40d47c8db53ac2af38500 (patch)
treed6b7c6b21c7a6e0e3620a3e0c7198e63454d05e3 /src/nxt_log.h
parent16cbf3c076a0aca6d47adaf3f719493674cf2363 (diff)
downloadunit-de532922d9ab42aa15b40d47c8db53ac2af38500.tar.gz
unit-de532922d9ab42aa15b40d47c8db53ac2af38500.tar.bz2
Introducing tasks.
Diffstat (limited to '')
-rw-r--r--src/nxt_log.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/nxt_log.h b/src/nxt_log.h
index cbd7d09b..d04bc3dd 100644
--- a/src/nxt_log.h
+++ b/src/nxt_log.h
@@ -66,6 +66,27 @@ nxt_log_alert(_log, ...) \
} while (0)
+#define nxt_log(task, _level, ...) \
+ do { \
+ nxt_log_t *log = (task)->log; \
+ nxt_uint_t _level_ = (_level); \
+ \
+ if (nxt_slow_path(log->level >= _level_)) { \
+ log->handler(_level_, log, __VA_ARGS__); \
+ } \
+ } while (0)
+
+
+#define nxt_trace(task, ...) \
+ do { \
+ nxt_log_t *log = (task)->log; \
+ \
+ if (nxt_slow_path(log->level >= NXT_LOG_NOTICE || nxt_trace)) { \
+ log->handler(NXT_LOG_NOTICE, log, __VA_ARGS__); \
+ } \
+ } while (0)
+
+
#define \
nxt_log_error(_level, _log, ...) \
do { \
@@ -80,6 +101,16 @@ nxt_log_error(_level, _log, ...) \
#if (NXT_DEBUG)
+#define nxt_debug(task, ...) \
+ do { \
+ nxt_log_t *log = (task)->log; \
+ \
+ if (nxt_slow_path(log->level == NXT_LOG_DEBUG || nxt_debug)) { \
+ log->handler(NXT_LOG_DEBUG, log, __VA_ARGS__); \
+ } \
+ } while (0)
+
+
#define \
nxt_log_debug(_log, ...) \
do { \
@@ -92,6 +123,8 @@ nxt_log_debug(_log, ...) \
#else
+#define nxt_log_debug(...)
+
#define \
nxt_log_debug(...)
@@ -119,6 +152,7 @@ nxt_main_log_debug(...) \
NXT_EXPORT extern nxt_uint_t nxt_debug;
+NXT_EXPORT extern nxt_uint_t nxt_trace;
NXT_EXPORT extern nxt_log_t nxt_main_log;
NXT_EXPORT extern nxt_str_t nxt_log_levels[];