diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-02-07 17:13:51 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-02-07 17:13:51 -0500 |
commit | 3433216268a97f8c1595fd389da0e960e8074d32 (patch) | |
tree | 059f7b25c662162f1015fb5cafd82d2010754d65 /src/common/torlog.h | |
parent | e5b07ba17947ba4782cbac8f12de7024b2969c99 (diff) | |
parent | a7334f5122046b55a5eff425cdaaa3e56c5defed (diff) | |
download | tor-3433216268a97f8c1595fd389da0e960e8074d32.tar.gz tor-3433216268a97f8c1595fd389da0e960e8074d32.zip |
Merge remote-tracking branch 'public/easy_ratelim'
Conflicts:
src/or/connection.c
Diffstat (limited to 'src/common/torlog.h')
-rw-r--r-- | src/common/torlog.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common/torlog.h b/src/common/torlog.h index 23ee597a4e..8675d7b6e7 100644 --- a/src/common/torlog.h +++ b/src/common/torlog.h @@ -160,10 +160,20 @@ extern int log_global_min_severity_; void log_fn_(int severity, log_domain_mask_t domain, const char *funcname, const char *format, ...) CHECK_PRINTF(4,5); +struct ratelim_t; +void log_fn_ratelim_(struct ratelim_t *ratelim, int severity, + log_domain_mask_t domain, const char *funcname, + const char *format, ...) + CHECK_PRINTF(5,6); /** Log a message at level <b>severity</b>, using a pretty-printed version * of the current function name. */ #define log_fn(severity, domain, args...) \ log_fn_(severity, domain, __PRETTY_FUNCTION__, args) +/** As log_fn, but use <b>ratelim</b> (an instance of ratelim_t) to control + * the frequency at which messages can appear. + */ +#define log_fn_ratelim(ratelim, severity, domain, args...) \ + log_fn_ratelim_(ratelim, severity, domain, __PRETTY_FUNCTION__, args) #define log_debug(domain, args...) \ STMT_BEGIN \ if (PREDICT_UNLIKELY(log_global_min_severity_ == LOG_DEBUG)) \ @@ -181,6 +191,9 @@ void log_fn_(int severity, log_domain_mask_t domain, #else /* ! defined(__GNUC__) */ void log_fn_(int severity, log_domain_mask_t domain, const char *format, ...); +struct ratelim_t; +void log_fn_ratelim_(struct ratelim_t *ratelim, int severity, + log_domain_mask_t domain, const char *format, ...); void log_debug_(log_domain_mask_t domain, const char *format, ...); void log_info_(log_domain_mask_t domain, const char *format, ...); void log_notice_(log_domain_mask_t domain, const char *format, ...); @@ -190,6 +203,7 @@ void log_err_(log_domain_mask_t domain, const char *format, ...); #if defined(_MSC_VER) && _MSC_VER < 1300 /* MSVC 6 and earlier don't have __func__, or even __LINE__. */ #define log_fn log_fn_ +#define log_fn_ratelim log_fn_ratelim_ #define log_debug log_debug_ #define log_info log_info_ #define log_notice log_notice_ @@ -203,6 +217,7 @@ extern const char *log_fn_function_name_; * do {...} while (0) trick to wrap this macro, since the macro can't take * arguments. */ #define log_fn (log_fn_function_name_=__func__),log_fn_ +#define log_fn_ratelim (log_fn_function_name_=__func__),log_fn_ratelim_ #define log_debug (log_fn_function_name_=__func__),log_debug_ #define log_info (log_fn_function_name_=__func__),log_info_ #define log_notice (log_fn_function_name_=__func__),log_notice_ |