mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 12:41:00 +02:00
MINOR: log: add log_orig_proxy() helper function
Function may be used on proxy where log-steps are used to check if a given log origin should be handled or not.
This commit is contained in:
parent
c043d5d372
commit
4189eb7aca
@ -66,6 +66,7 @@ int init_log_buffers(void);
|
||||
void deinit_log_buffers(void);
|
||||
|
||||
const char *log_orig_to_str(enum log_orig_id orig);
|
||||
int log_orig_proxy(enum log_orig_id orig, struct proxy *px);
|
||||
|
||||
void lf_expr_init(struct lf_expr *expr);
|
||||
int lf_expr_dup(const struct lf_expr *orig, struct lf_expr *dest);
|
||||
|
||||
21
src/log.c
21
src/log.c
@ -128,6 +128,27 @@ const char *log_orig_to_str(enum log_orig_id orig)
|
||||
return "unspec";
|
||||
}
|
||||
|
||||
/* Check if <orig> log origin is set for logging on <px>
|
||||
*
|
||||
* It is assumed that the caller already checked that log-steps were
|
||||
* enabled on the proxy (do_log special value LW_LOGSTEPS)
|
||||
*
|
||||
* Returns 1 for true and 0 for false
|
||||
*/
|
||||
int log_orig_proxy(enum log_orig_id orig, struct proxy *px)
|
||||
{
|
||||
if (eb_is_empty(&px->conf.log_steps)) {
|
||||
/* empty tree means all log steps are enabled, thus
|
||||
* all log origins are considered
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
/* selectively check if the current log origin is referenced in
|
||||
* proxy log-steps
|
||||
*/
|
||||
return !!eb32_lookup(&px->conf.log_steps, orig);
|
||||
}
|
||||
|
||||
/*
|
||||
* This map is used with all the FD_* macros to check whether a particular bit
|
||||
* is set or not. Each bit represents an ASCII code. ha_bit_set() sets those
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user