1 
2 /*
3  * Copyright (C) Igor Sysoev
4  * Copyright (C) NGINX, Inc.
5  */
6 
7 #ifndef _NXT_THREAD_LOG_H_INCLUDED_
8 #define _NXT_THREAD_LOG_H_INCLUDED_
9 
10 
11 #define nxt_thread_log_alert(...)                                             \
12     do {                                                                      \
13         nxt_thread_t  *_thr = nxt_thread();                                   \
14                                                                               \
15         nxt_log_alert(_thr->log, __VA_ARGS__);                                \
16                                                                               \
17     } while (0)
18 
19 
20 #define nxt_thread_log_error(_level, ...)                                     \
21     do {                                                                      \
22         nxt_thread_t  *_thr = nxt_thread();                                   \
23                                                                               \
24         nxt_log_error(_level, _thr->log, __VA_ARGS__);                        \
25                                                                               \
26     } while (0)
27 
28 
29 #if (NXT_DEBUG)
30 
31 #define nxt_thread_log_debug(...)                                             \
32     do {                                                                      \
33         nxt_thread_t  *_thr = nxt_thread();                                   \
34                                                                               \
35         nxt_log_debug(_thr->log, __VA_ARGS__);                                \
36                                                                               \
37     } while (0)
38 
39 
40 #define nxt_thread_debug(thr)                                                 \
41     nxt_thread_t  *thr = nxt_thread()
42 
43 #else
44 
45 #define nxt_thread_log_debug(...)
46 #define nxt_thread_debug(thr)
47 
48 #endif
49 
50 
51 nxt_inline nxt_log_t *
nxt_thread_log(void)52 nxt_thread_log(void)
53 {
54     nxt_thread_t  *thr;
55 
56     thr = nxt_thread();
57     return thr->log;
58 }
59 
60 
61 #endif /* _NXT_THREAD_LOG_H_INCLUDED_ */
62