[nginx] Core: moved ngx_log_set_levels() to a proper position.

Maxim Dounin mdounin at mdounin.ru
Tue Jun 25 20:31:21 UTC 2024


details:   http://freenginx.org/hg/nginx/rev/e1f15d47d102
branches:  
changeset: 9297:e1f15d47d102
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Tue Jun 25 22:58:11 2024 +0300
description:
Core: moved ngx_log_set_levels() to a proper position.

Previous order is an artifact from the time before 5254:7ecaa9e4bf1b,
when ngx_log_set_levels() was a non-static function.

No functional changes.

diffstat:

 src/core/ngx_log.c |  126 ++++++++++++++++++++++++++--------------------------
 1 files changed, 63 insertions(+), 63 deletions(-)

diffs (143 lines):

diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -476,69 +476,6 @@ ngx_log_get_file_log(ngx_log_t *head)
 
 
 static char *
-ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log)
-{
-    ngx_uint_t   i, n, d, found;
-    ngx_str_t   *value;
-
-    if (cf->args->nelts == 2) {
-        log->log_level = NGX_LOG_ERR;
-        return NGX_CONF_OK;
-    }
-
-    value = cf->args->elts;
-
-    for (i = 2; i < cf->args->nelts; i++) {
-        found = 0;
-
-        for (n = 1; n <= NGX_LOG_DEBUG; n++) {
-            if (ngx_strcmp(value[i].data, err_levels[n].data) == 0) {
-
-                if (log->log_level != 0) {
-                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                                       "duplicate log level \"%V\"",
-                                       &value[i]);
-                    return NGX_CONF_ERROR;
-                }
-
-                log->log_level = n;
-                found = 1;
-                break;
-            }
-        }
-
-        for (n = 0, d = NGX_LOG_DEBUG_FIRST; d <= NGX_LOG_DEBUG_LAST; d <<= 1) {
-            if (ngx_strcmp(value[i].data, debug_levels[n++]) == 0) {
-                if (log->log_level & ~NGX_LOG_DEBUG_ALL) {
-                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                                       "invalid log level \"%V\"",
-                                       &value[i]);
-                    return NGX_CONF_ERROR;
-                }
-
-                log->log_level |= d;
-                found = 1;
-                break;
-            }
-        }
-
-
-        if (!found) {
-            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
-                               "invalid log level \"%V\"", &value[i]);
-            return NGX_CONF_ERROR;
-        }
-    }
-
-    if (log->log_level == NGX_LOG_DEBUG) {
-        log->log_level = NGX_LOG_DEBUG_ALL;
-    }
-
-    return NGX_CONF_OK;
-}
-
-
-static char *
 ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 {
     ngx_log_t  *dummy;
@@ -673,6 +610,69 @@ ngx_log_set_log(ngx_conf_t *cf, ngx_log_
 }
 
 
+static char *
+ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log)
+{
+    ngx_uint_t   i, n, d, found;
+    ngx_str_t   *value;
+
+    if (cf->args->nelts == 2) {
+        log->log_level = NGX_LOG_ERR;
+        return NGX_CONF_OK;
+    }
+
+    value = cf->args->elts;
+
+    for (i = 2; i < cf->args->nelts; i++) {
+        found = 0;
+
+        for (n = 1; n <= NGX_LOG_DEBUG; n++) {
+            if (ngx_strcmp(value[i].data, err_levels[n].data) == 0) {
+
+                if (log->log_level != 0) {
+                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                                       "duplicate log level \"%V\"",
+                                       &value[i]);
+                    return NGX_CONF_ERROR;
+                }
+
+                log->log_level = n;
+                found = 1;
+                break;
+            }
+        }
+
+        for (n = 0, d = NGX_LOG_DEBUG_FIRST; d <= NGX_LOG_DEBUG_LAST; d <<= 1) {
+            if (ngx_strcmp(value[i].data, debug_levels[n++]) == 0) {
+                if (log->log_level & ~NGX_LOG_DEBUG_ALL) {
+                    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                                       "invalid log level \"%V\"",
+                                       &value[i]);
+                    return NGX_CONF_ERROR;
+                }
+
+                log->log_level |= d;
+                found = 1;
+                break;
+            }
+        }
+
+
+        if (!found) {
+            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                               "invalid log level \"%V\"", &value[i]);
+            return NGX_CONF_ERROR;
+        }
+    }
+
+    if (log->log_level == NGX_LOG_DEBUG) {
+        log->log_level = NGX_LOG_DEBUG_ALL;
+    }
+
+    return NGX_CONF_OK;
+}
+
+
 static void
 ngx_log_insert(ngx_log_t *log, ngx_log_t *new_log)
 {



More information about the nginx-devel mailing list