Author: vbart Date: 2013-02-27 16:56:47 +0000 (Wed, 27 Feb 2013) New Revision: 5087 URL: http://trac.nginx.org/nginx/changeset/5087/nginx
Log: Introduced the ngx_http_set_connection_log() macro. No functional changes. Modified: trunk/src/http/ngx_http_core_module.c trunk/src/http/ngx_http_request.c trunk/src/http/ngx_http_request.h Modified: trunk/src/http/ngx_http_core_module.c =================================================================== --- trunk/src/http/ngx_http_core_module.c 2013-02-27 16:53:01 UTC (rev 5086) +++ trunk/src/http/ngx_http_core_module.c 2013-02-27 16:56:47 UTC (rev 5087) @@ -1461,11 +1461,7 @@ } if (r == r->main) { - r->connection->log->file = clcf->error_log->file; - - if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { - r->connection->log->log_level = clcf->error_log->log_level; - } + ngx_http_set_connection_log(r->connection, clcf->error_log); } if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) { Modified: trunk/src/http/ngx_http_request.c =================================================================== --- trunk/src/http/ngx_http_request.c 2013-02-27 16:53:01 UTC (rev 5086) +++ trunk/src/http/ngx_http_request.c 2013-02-27 16:56:47 UTC (rev 5087) @@ -443,11 +443,9 @@ #endif 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)) { - c->log->log_level = clcf->error_log->log_level; - } + ngx_http_set_connection_log(r->connection, clcf->error_log); + if (c->buffer == NULL) { c->buffer = ngx_create_temp_buf(c->pool, cscf->client_header_buffer_size); @@ -1852,11 +1850,8 @@ r->loc_conf = cscf->ctx->loc_conf; 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)) { - r->connection->log->log_level = clcf->error_log->log_level; - } + ngx_http_set_connection_log(r->connection, clcf->error_log); return NGX_OK; } Modified: trunk/src/http/ngx_http_request.h =================================================================== --- trunk/src/http/ngx_http_request.h 2013-02-27 16:53:01 UTC (rev 5086) +++ trunk/src/http/ngx_http_request.h 2013-02-27 16:56:47 UTC (rev 5087) @@ -571,4 +571,12 @@ 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_ */ _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel