mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
MEDIUM: log: add a log level override value in struct session
This log level will be used in a further patch to change the log level depending on the request or response.
This commit is contained in:
parent
f4c43c13be
commit
abcd5145f8
@ -151,6 +151,7 @@ struct session {
|
||||
struct stream_interface si[2]; /* client and server stream interfaces */
|
||||
struct {
|
||||
int logwait; /* log fields waiting to be collected : LW_* */
|
||||
int level; /* log level to force + 1 if > 0, -1 = no log */
|
||||
struct timeval accept_date; /* date of the accept() in user date */
|
||||
struct timeval tv_accept; /* date of the accept() in internal date (monotonic) */
|
||||
struct timeval tv_request; /* date the request arrives, {0,0} if never occurs */
|
||||
|
15
src/log.c
15
src/log.c
@ -1528,9 +1528,18 @@ void sess_log(struct session *s)
|
||||
if (LIST_ISEMPTY(&s->fe->logsrvs))
|
||||
return;
|
||||
|
||||
level = LOG_INFO;
|
||||
if (err && (s->fe->options2 & PR_O2_LOGERRORS))
|
||||
level = LOG_ERR;
|
||||
if (s->logs.level) { /* loglevel was overridden */
|
||||
if (s->logs.level == -1) {
|
||||
s->logs.logwait = 0; /* logs disabled */
|
||||
return;
|
||||
}
|
||||
level = s->logs.level - 1;
|
||||
}
|
||||
else {
|
||||
level = LOG_INFO;
|
||||
if (err && (s->fe->options2 & PR_O2_LOGERRORS))
|
||||
level = LOG_ERR;
|
||||
}
|
||||
|
||||
tmplog = update_log_hdr();
|
||||
size = tmplog - logline;
|
||||
|
@ -1185,6 +1185,7 @@ static struct session *peer_session_create(struct peer *peer, struct peer_sessio
|
||||
*/
|
||||
|
||||
s->logs.logwait = 0;
|
||||
s->logs.level = 0;
|
||||
s->do_log = NULL;
|
||||
|
||||
/* default error reporting function, may be changed by analysers */
|
||||
|
@ -2528,6 +2528,7 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit)
|
||||
msg->msg_state = HTTP_MSG_RQBEFORE;
|
||||
req->analysers = 0;
|
||||
s->logs.logwait = 0;
|
||||
s->logs.level = 0;
|
||||
s->rep->flags &= ~CF_EXPECT_MORE; /* speed up sending a previous response */
|
||||
stream_int_retnclose(req->prod, NULL);
|
||||
return 0;
|
||||
@ -8315,6 +8316,7 @@ void http_reset_txn(struct session *s)
|
||||
|
||||
s->be = s->fe;
|
||||
s->logs.logwait = s->fe->to_log;
|
||||
s->logs.level = 0;
|
||||
session_del_srv_conn(s);
|
||||
s->target = NULL;
|
||||
/* re-init store persistence */
|
||||
|
Loading…
Reference in New Issue
Block a user