]> git.kaiwu.me - njs.git/commitdiff
Fixed error logging in js_include.
authorDmitry Volyntsev <xeioex@nginx.com>
Mon, 28 May 2018 14:05:16 +0000 (17:05 +0300)
committerDmitry Volyntsev <xeioex@nginx.com>
Mon, 28 May 2018 14:05:16 +0000 (17:05 +0300)
Previously, ngx_log_error() was used instead of ngx_conf_log_error()
in js_include directive handler.   Replacing it with ngx_conf_log_error()
to report the additional information about the location of the directive
in the configuration file.

nginx/ngx_http_js_module.c
nginx/ngx_stream_js_module.c

index 60e8cf611a27a76e1d3b387fdaa4a3fbaab5a41d..111ce852374d42d4da68400a5301f2bb40e7e3bf 100644 (file)
@@ -2189,8 +2189,8 @@ ngx_http_js_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     }
 
     if (ngx_fd_info(fd, &fi) == NGX_FILE_ERROR) {
-        ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno,
-                      ngx_fd_info_n " \"%s\" failed", file.data);
+        ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
+                           ngx_fd_info_n " \"%s\" failed", file.data);
         (void) ngx_close_file(fd);
         return NGX_CONF_ERROR;
     }
@@ -2206,25 +2206,25 @@ ngx_http_js_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     n = ngx_read_fd(fd, start,  size);
 
     if (n == -1) {
-        ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
-                      ngx_read_fd_n " \"%s\" failed", file.data);
+        ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
+                           ngx_read_fd_n " \"%s\" failed", file.data);
 
         (void) ngx_close_file(fd);
         return NGX_CONF_ERROR;
     }
 
     if ((size_t) n != size) {
-        ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
-                      ngx_read_fd_n " has read only %z of %O from \"%s\"",
-                      n, size, file.data);
+        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                           ngx_read_fd_n " has read only %z of %O from \"%s\"",
+                           n, size, file.data);
 
         (void) ngx_close_file(fd);
         return NGX_CONF_ERROR;
     }
 
     if (ngx_close_file(fd) == NGX_FILE_ERROR) {
-        ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
-                      ngx_close_file_n " %s failed", file.data);
+        ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
+                           ngx_close_file_n " %s failed", file.data);
     }
 
     end = start + size;
index 12f18ebd392a27d2c27a25c15e5fcc2e8e84d0f8..4f96e33a54e4cf29149304b7c01107944361c2f8 100644 (file)
@@ -978,8 +978,8 @@ ngx_stream_js_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     }
 
     if (ngx_fd_info(fd, &fi) == NGX_FILE_ERROR) {
-        ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno,
-                      ngx_fd_info_n " \"%s\" failed", file.data);
+        ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
+                           ngx_fd_info_n " \"%s\" failed", file.data);
         (void) ngx_close_file(fd);
         return NGX_CONF_ERROR;
     }
@@ -995,25 +995,25 @@ ngx_stream_js_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     n = ngx_read_fd(fd, start,  size);
 
     if (n == -1) {
-        ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
-                      ngx_read_fd_n " \"%s\" failed", file.data);
+        ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
+                           ngx_read_fd_n " \"%s\" failed", file.data);
 
         (void) ngx_close_file(fd);
         return NGX_CONF_ERROR;
     }
 
     if ((size_t) n != size) {
-        ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
-                      ngx_read_fd_n " has read only %z of %uz from \"%s\"",
-                      n, size, file.data);
+        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                           ngx_read_fd_n " has read only %z of %uz from \"%s\"",
+                           n, size, file.data);
 
         (void) ngx_close_file(fd);
         return NGX_CONF_ERROR;
     }
 
     if (ngx_close_file(fd) == NGX_FILE_ERROR) {
-        ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
-                      ngx_close_file_n " %s failed", file.data);
+        ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
+                           ngx_close_file_n " %s failed", file.data);
     }
 
     end = start + size;