]> git.kaiwu.me - nginx.git/commitdiff
Introduced the ngx_http_set_connection_log() macro.
authorValentin Bartenev <vbart@nginx.com>
Wed, 27 Feb 2013 16:56:47 +0000 (16:56 +0000)
committerValentin Bartenev <vbart@nginx.com>
Wed, 27 Feb 2013 16:56:47 +0000 (16:56 +0000)
No functional changes.

src/http/ngx_http_core_module.c
src/http/ngx_http_request.c
src/http/ngx_http_request.h

index 16e6ddb5d3bb45bb88977219c3f017226dc8ed1a..c4914997bd1fcf6b48f0ed8ef2d1b32277641d10 100644 (file)
@@ -1461,11 +1461,7 @@ ngx_http_update_location_config(ngx_http_request_t *r)
     }
 
     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) {
index c1ee921fc28e27c03a2dcb8ea7946189a0c024c2..9b66718a2d3da1498f97a1af41c7ce9dbb2f05ec 100644 (file)
@@ -443,10 +443,8 @@ ngx_http_init_request(ngx_event_t *rev)
 #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,
@@ -1852,11 +1850,8 @@ found:
     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;
 }
index d7d076083e44bad40ed0363bf3981996a732ccaa..7ceea62255f9b53a46312ba17cfbdd40b4309674 100644 (file)
@@ -571,4 +571,12 @@ extern ngx_http_header_t       ngx_http_headers_in[];
 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_ */