]> git.kaiwu.me - nginx.git/commitdiff
Core: the ngx_set_connection_log() macro.
authorVladimir Homutov <vl@nginx.com>
Sat, 25 Apr 2015 19:44:02 +0000 (22:44 +0300)
committerVladimir Homutov <vl@nginx.com>
Sat, 25 Apr 2015 19:44:02 +0000 (22:44 +0300)
The http and stream versions of this macro were identical.

src/core/ngx_connection.h
src/http/ngx_http_core_module.c
src/http/ngx_http_request.c
src/http/ngx_http_request.h
src/stream/ngx_stream.c
src/stream/ngx_stream.h
src/stream/ngx_stream_handler.c

index f1ca9619b5a758f18363618ca78a3eed15db28a4..27bb8a99c4a6bc149702475a16ab409988949bdc 100644 (file)
@@ -190,6 +190,17 @@ struct ngx_connection_s {
 };
 
 
+#define ngx_set_connection_log(c, l)                                         \
+                                                                             \
+    c->log->file = l->file;                                                  \
+    c->log->next = l->next;                                                  \
+    c->log->writer = l->writer;                                              \
+    c->log->wdata = l->wdata;                                                \
+    if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {                   \
+        c->log->log_level = l->log_level;                                    \
+    }
+
+
 ngx_listening_t *ngx_create_listening(ngx_conf_t *cf, void *sockaddr,
     socklen_t socklen);
 ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle);
index 096a561c4cb0ab332361d0a6435334418c6b1578..81960414f4332a5be20a491a4ea885aa5f2f5505 100644 (file)
@@ -1445,7 +1445,7 @@ ngx_http_update_location_config(ngx_http_request_t *r)
     }
 
     if (r == r->main) {
-        ngx_http_set_connection_log(r->connection, clcf->error_log);
+        ngx_set_connection_log(r->connection, clcf->error_log);
     }
 
     if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
index a0d75ff879a6d48da7e54f0c74ed208f46fc0399..2669b522c1dd785db6b4c44fa57306499e95288c 100644 (file)
@@ -543,7 +543,7 @@ ngx_http_create_request(ngx_connection_t *c)
 
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
-    ngx_http_set_connection_log(r->connection, clcf->error_log);
+    ngx_set_connection_log(r->connection, clcf->error_log);
 
     r->header_in = hc->nbusy ? hc->busy[0] : c->buffer;
 
@@ -867,7 +867,7 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
 
     clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module);
 
-    ngx_http_set_connection_log(c, clcf->error_log);
+    ngx_set_connection_log(c, clcf->error_log);
 
     sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module);
 
@@ -2073,7 +2073,7 @@ ngx_http_set_virtual_server(ngx_http_request_t *r, ngx_str_t *host)
 
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
-    ngx_http_set_connection_log(r->connection, clcf->error_log);
+    ngx_set_connection_log(r->connection, clcf->error_log);
 
     return NGX_OK;
 }
index ead4d236f081fc93d8ab55117af1014409d1a3ce..3954de3f1608a59034b74e584f46f4879bba2803 100644 (file)
@@ -586,17 +586,6 @@ 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;                                                   \
-    c->log->next = l->next;                                                   \
-    c->log->writer = l->writer;                                               \
-    c->log->wdata = l->wdata;                                                 \
-    if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {                    \
-        c->log->log_level = l->log_level;                                     \
-    }
-
-
 #define ngx_http_set_log_request(log, r)                                      \
     ((ngx_http_log_ctx_t *) log->data)->current_request = r
 
index f982170c1bed35e296250f3d6e850d2da589a8f8..e5ffcf9bc970a97f9f878609cc9c1698f856690e 100644 (file)
@@ -370,8 +370,8 @@ ngx_stream_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
             ls->pool_size = 256;
 
             cscf = addr->ctx->srv_conf[ngx_stream_core_module.ctx_index];
-            ls->logp = cscf->error_log;
 
+            ls->logp = cscf->error_log;
             ls->log.data = &ls->addr_text;
             ls->log.handler = ngx_accept_log_error;
 
index 6ac1fd586e3e3bb4e62a750a3089fb02ca1ee955..83a43a41fe319cd77bba9600f9158f4deb4654e4 100644 (file)
@@ -192,16 +192,6 @@ typedef struct {
             ->main_conf[module.ctx_index]:                                     \
         NULL)
 
-#define ngx_stream_set_connection_log(c, l)                                    \
-                                                                               \
-    c->log->file = l->file;                                                    \
-    c->log->next = l->next;                                                    \
-    c->log->writer = l->writer;                                                \
-    c->log->wdata = l->wdata;                                                  \
-    if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {                     \
-        c->log->log_level = l->log_level;                                      \
-    }
-
 
 void ngx_stream_init_connection(ngx_connection_t *c);
 void ngx_stream_close_connection(ngx_connection_t *c);
index c05e905c4a910fbab2ac872bbdfdbc4b781ee2bc..2be5183c1bb0d6cb9d12af23b3020ecce894f0b8 100644 (file)
@@ -130,7 +130,7 @@ ngx_stream_init_connection(ngx_connection_t *c)
 
     cscf = ngx_stream_get_module_srv_conf(s, ngx_stream_core_module);
 
-    ngx_stream_set_connection_log(c, cscf->error_log);
+    ngx_set_connection_log(c, cscf->error_log);
 
     len = ngx_sock_ntop(c->sockaddr, c->socklen, text, NGX_SOCKADDR_STRLEN, 1);