diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
commit | 16cbf3c076a0aca6d47adaf3f719493674cf2363 (patch) | |
tree | e6530480020f62a2bdbf249988ec3e2a751d3927 /src/nxt_thread_log.h | |
download | unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.gz unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.bz2 |
Initial version.
Diffstat (limited to 'src/nxt_thread_log.h')
-rw-r--r-- | src/nxt_thread_log.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/nxt_thread_log.h b/src/nxt_thread_log.h new file mode 100644 index 00000000..2950ae3e --- /dev/null +++ b/src/nxt_thread_log.h @@ -0,0 +1,70 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) NGINX, Inc. + */ + +#ifndef _NXT_THREAD_LOG_H_INCLUDED_ +#define _NXT_THREAD_LOG_H_INCLUDED_ + + +#define nxt_thread_log_emerg(...) \ + do { \ + nxt_thread_t *_thr = nxt_thread(); \ + \ + nxt_log_emerg(_thr->log, __VA_ARGS__); \ + \ + } while (0) + + +#define nxt_thread_log_alert(...) \ + do { \ + nxt_thread_t *_thr = nxt_thread(); \ + \ + nxt_log_alert(_thr->log, __VA_ARGS__); \ + \ + } while (0) + + +#define nxt_thread_log_error(_level, ...) \ + do { \ + nxt_thread_t *_thr = nxt_thread(); \ + \ + nxt_log_error(_level, _thr->log, __VA_ARGS__); \ + \ + } while (0) + + +#if (NXT_DEBUG) + +#define nxt_thread_log_debug(...) \ + do { \ + nxt_thread_t *_thr = nxt_thread(); \ + \ + nxt_log_debug(_thr->log, __VA_ARGS__); \ + \ + } while (0) + + +#define nxt_thread_debug(thr) \ + nxt_thread_t *thr = nxt_thread() + +#else + +#define nxt_thread_log_debug(...) +#define nxt_thread_debug(thr) + +#endif + + +nxt_inline nxt_log_t * +nxt_thread_log(void) +{ + nxt_thread_t *thr; + + thr = nxt_thread(); + return thr->log; +} + + +#endif /* _NXT_THREAD_LOG_H_INCLUDED_ */ |