nxt_log_moderation.h (564:762f8c976ead) nxt_log_moderation.h (2084:7d479274f334)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_LOG_MODERATION_H_INCLUDED_
8#define _NXT_LOG_MODERATION_H_INCLUDED_

--- 9 unchanged lines hidden (view full) ---

18 nxt_time_t last;
19 nxt_timer_t timer;
20} nxt_log_moderation_t;
21
22
23#define NXT_LOG_MODERATION 0, -1, 0, 0, NXT_TIMER
24
25
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#ifndef _NXT_LOG_MODERATION_H_INCLUDED_
8#define _NXT_LOG_MODERATION_H_INCLUDED_

--- 9 unchanged lines hidden (view full) ---

18 nxt_time_t last;
19 nxt_timer_t timer;
20} nxt_log_moderation_t;
21
22
23#define NXT_LOG_MODERATION 0, -1, 0, 0, NXT_TIMER
24
25
26#define \
27nxt_log_alert_moderate(_mod, _log, ...) \
26#define nxt_log_alert_moderate(_mod, _log, ...) \
28 do { \
29 nxt_log_t *_log_ = _log; \
30 \
31 if (nxt_log_moderate_allow(_mod)) { \
32 _log_->handler(NXT_LOG_ALERT, _log_, __VA_ARGS__); \
33 } \
34 } while (0)
35
36
27 do { \
28 nxt_log_t *_log_ = _log; \
29 \
30 if (nxt_log_moderate_allow(_mod)) { \
31 _log_->handler(NXT_LOG_ALERT, _log_, __VA_ARGS__); \
32 } \
33 } while (0)
34
35
37#define \
38nxt_log_moderate(_mod, _level, _log, ...) \
36#define nxt_log_moderate(_mod, _level, _log, ...) \
39 do { \
40 nxt_log_t *_log_ = _log; \
41 \
42 if (_log_->level >= (_level) && nxt_log_moderate_allow(_mod)) { \
43 _log_->handler(_level, _log_, __VA_ARGS__); \
44 } \
45 } while (0)
46
47
48nxt_bool_t nxt_log_moderate_allow(nxt_log_moderation_t *mod);
49
50
51#endif /* _NXT_LOG_MODERATION_H_INCLUDED_ */
37 do { \
38 nxt_log_t *_log_ = _log; \
39 \
40 if (_log_->level >= (_level) && nxt_log_moderate_allow(_mod)) { \
41 _log_->handler(_level, _log_, __VA_ARGS__); \
42 } \
43 } while (0)
44
45
46nxt_bool_t nxt_log_moderate_allow(nxt_log_moderation_t *mod);
47
48
49#endif /* _NXT_LOG_MODERATION_H_INCLUDED_ */