Introduced the ngx_http_set_connection_log() macro.

No functional changes.
This commit is contained in:
Valentin Bartenev 2013-02-27 16:56:47 +00:00
parent 508afb8cf5
commit b314102ff1
3 changed files with 12 additions and 13 deletions

View File

@ -1461,11 +1461,7 @@ ngx_http_update_location_config(ngx_http_request_t *r)
} }
if (r == r->main) { if (r == r->main) {
r->connection->log->file = clcf->error_log->file; ngx_http_set_connection_log(r->connection, clcf->error_log);
if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
r->connection->log->log_level = clcf->error_log->log_level;
}
} }
if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) { if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {

View File

@ -443,10 +443,8 @@ ngx_http_init_request(ngx_event_t *rev)
#endif #endif
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
c->log->file = clcf->error_log->file;
if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { ngx_http_set_connection_log(r->connection, clcf->error_log);
c->log->log_level = clcf->error_log->log_level;
}
if (c->buffer == NULL) { if (c->buffer == NULL) {
c->buffer = ngx_create_temp_buf(c->pool, c->buffer = ngx_create_temp_buf(c->pool,
@ -1852,11 +1850,8 @@ found:
r->loc_conf = cscf->ctx->loc_conf; r->loc_conf = cscf->ctx->loc_conf;
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
r->connection->log->file = clcf->error_log->file;
if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { ngx_http_set_connection_log(r->connection, clcf->error_log);
r->connection->log->log_level = clcf->error_log->log_level;
}
return NGX_OK; return NGX_OK;
} }

View File

@ -571,4 +571,12 @@ extern ngx_http_header_t ngx_http_headers_in[];
extern ngx_http_header_out_t ngx_http_headers_out[]; extern ngx_http_header_out_t ngx_http_headers_out[];
#define ngx_http_set_connection_log(c, l) \
\
c->log->file = l->file; \
if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { \
c->log->log_level = l->log_level; \
}
#endif /* _NGX_HTTP_REQUEST_H_INCLUDED_ */ #endif /* _NGX_HTTP_REQUEST_H_INCLUDED_ */