summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_thread_log.h
blob: 214098ffadd3cfa500ff617a25192a14a7ee5d95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) NGINX, Inc.
 */

#ifndef _NXT_THREAD_LOG_H_INCLUDED_
#define _NXT_THREAD_LOG_H_INCLUDED_


#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_ */