diff src/core/ngx_log.h @ 483:621229427cba release-0.1.16

nginx-0.1.16-RELEASE import *) Bugfix: if the response were transferred by chunks, then on the HEAD request the final chunk was issued. *) Bugfix: the "Connection: keep-alive" header were issued, even if the keepalive_timeout directive forbade the keep-alive use. *) Bugfix: the errors in the ngx_http_fastcgi_module caused the segmentation faults. *) Bugfix: the compressed response encrypted by SSL may not transferred complete. *) Bugfix: the TCP-specific TCP_NODELAY, TCP_NOPSUH, and TCP_CORK options, are not used for the unix domain sockets. *) Feature: the rewrite directive supports the arguments rewriting. *) Bugfix: the response code 400 was returned for the POST request with the "Content-Length: 0" header; the bug had appeared in 0.1.14.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 25 Jan 2005 12:27:35 +0000
parents a88a3e4e158f
children 975f62e77f02
line wrap: on
line diff
--- a/src/core/ngx_log.h
+++ b/src/core/ngx_log.h
@@ -40,14 +40,25 @@
 #define NGX_LOG_DEBUG_ALL         0x7ffffff0
 
 
-typedef u_char *(*ngx_log_handler_pt) (void *ctx, u_char *buf, size_t len);
+typedef u_char *(*ngx_log_handler_pt) (ngx_log_t *log, u_char *buf, size_t len);
 
 
 struct ngx_log_s {
     ngx_uint_t           log_level;
     ngx_open_file_t     *file;
+
+    ngx_uint_t           connection;
+
+    ngx_log_handler_pt   handler;
     void                *data;
-    ngx_log_handler_pt   handler;
+
+    /*
+     * we declare "action" as "char *" because the actions are usually
+     * the static strings and in the "u_char *" case we have to override
+     * their types all the time
+     */
+
+    char                *action;
 };
 
 
@@ -60,24 +71,32 @@ struct ngx_log_s {
 
 #define NGX_HAVE_VARIADIC_MACROS  1
 
-#define ngx_log_error(level, log, args...) \
+#define ngx_log_error(level, log, args...)                                    \
         if (log->log_level >= level) ngx_log_error_core(level, log, args)
 
 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
                         const char *fmt, ...);
 
+#define ngx_log_debug(level, log, args...)                                    \
+    if (log->log_level & level)                                               \
+        ngx_log_error_core(NGX_LOG_DEBUG, log, args)
+
 /*********************************/
 
 #elif (NGX_HAVE_C99_VARIADIC_MACROS)
 
 #define NGX_HAVE_VARIADIC_MACROS  1
 
-#define ngx_log_error(level, log, ...) \
+#define ngx_log_error(level, log, ...)                                        \
         if (log->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
 
 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
                         const char *fmt, ...);
 
+#define ngx_log_debug(level, log, ...)                                        \
+    if (log->log_level & level)                                               \
+        ngx_log_error_core(NGX_LOG_DEBUG, log, __VA_ARGS__)
+
 /*********************************/
 
 #else /* NO VARIADIC MACROS */
@@ -100,80 +119,59 @@ void ngx_log_debug_core(ngx_log_t *log, 
 
 #if (NGX_HAVE_VARIADIC_MACROS)
 
-#define ngx_log_debug0(level, log, err, fmt) \
-    if (log->log_level & level) \
-        ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt)
-
-#define ngx_log_debug1(level, log, err, fmt, arg1) \
-    if (log->log_level & level) \
-        ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, arg1)
-
-#define ngx_log_debug2(level, log, err, fmt, arg1, arg2) \
-    if (log->log_level & level) \
-        ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, arg1, arg2)
-
-#define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3) \
-    if (log->log_level & level) \
-        ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, arg1, arg2, arg3)
-
-#define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \
-    if (log->log_level & level) \
-        ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, arg1, arg2, arg3, arg4)
-
-#define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \
-    if (log->log_level & level) \
-        ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, \
-                           arg1, arg2, arg3, arg4, arg5)
-
-#define ngx_log_debug6(level, log, err, fmt, \
-                       arg1, arg2, arg3, arg4, arg5, arg6) \
-    if (log->log_level & level) \
-        ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, \
-                           arg1, arg2, arg3, arg4, arg5, arg6)
-
-#define ngx_log_debug7(level, log, err, fmt, \
-                       arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
-    if (log->log_level & level) \
-        ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, \
-                           arg1, arg2, arg3, arg4, arg5, arg6, arg7)
+#define ngx_log_debug0  ngx_log_debug
+#define ngx_log_debug1  ngx_log_debug
+#define ngx_log_debug2  ngx_log_debug
+#define ngx_log_debug3  ngx_log_debug
+#define ngx_log_debug4  ngx_log_debug
+#define ngx_log_debug5  ngx_log_debug
+#define ngx_log_debug6  ngx_log_debug
+#define ngx_log_debug7  ngx_log_debug
+#define ngx_log_debug8  ngx_log_debug
 
 #else /* NO VARIADIC MACROS */
 
-#define ngx_log_debug0(level, log, err, fmt) \
-    if (log->log_level & level) \
+#define ngx_log_debug0(level, log, err, fmt)                                  \
+    if (log->log_level & level)                                               \
         ngx_log_debug_core(log, err, fmt)
 
-#define ngx_log_debug1(level, log, err, fmt, arg1) \
-    if (log->log_level & level) \
+#define ngx_log_debug1(level, log, err, fmt, arg1)                            \
+    if (log->log_level & level)                                               \
         ngx_log_debug_core(log, err, fmt, arg1)
 
-#define ngx_log_debug2(level, log, err, fmt, arg1, arg2) \
-    if (log->log_level & level) \
+#define ngx_log_debug2(level, log, err, fmt, arg1, arg2)                      \
+    if (log->log_level & level)                                               \
         ngx_log_debug_core(log, err, fmt, arg1, arg2)
 
-#define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3) \
-    if (log->log_level & level) \
+#define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3)                \
+    if (log->log_level & level)                                               \
         ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3)
 
-#define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \
-    if (log->log_level & level) \
+#define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4)          \
+    if (log->log_level & level)                                               \
         ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4)
 
-#define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \
-    if (log->log_level & level) \
+#define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5)    \
+    if (log->log_level & level)                                               \
         ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5)
 
-#define ngx_log_debug6(level, log, err, fmt, \
-                       arg1, arg2, arg3, arg4, arg5, arg6) \
-    if (log->log_level & level) \
+#define ngx_log_debug6(level, log, err, fmt,                                  \
+                       arg1, arg2, arg3, arg4, arg5, arg6)                    \
+    if (log->log_level & level)                                               \
         ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
 
-#define ngx_log_debug7(level, log, err, fmt, \
-                       arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
-    if (log->log_level & level) \
-        ngx_log_debug_core(log, err, fmt, \
+#define ngx_log_debug7(level, log, err, fmt,                                  \
+                       arg1, arg2, arg3, arg4, arg5, arg6, arg7)              \
+    if (log->log_level & level)                                               \
+        ngx_log_debug_core(log, err, fmt,                                     \
                        arg1, arg2, arg3, arg4, arg5, arg6, arg7)
 
+#define ngx_log_debug8(level, log, err, fmt,                                  \
+                       arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)        \
+    if (log->log_level & level)                                               \
+        ngx_log_debug_core(log, err, fmt,                                     \
+                       arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
+
 #endif
 
 #else /* NO NGX_DEBUG */
@@ -187,6 +185,8 @@ void ngx_log_debug_core(ngx_log_t *log, 
 #define ngx_log_debug6(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
 #define ngx_log_debug7(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5,    \
                        arg6, arg7)
+#define ngx_log_debug8(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5,    \
+                       arg6, arg7, arg8)
 
 #endif