comparison 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
comparison
equal deleted inserted replaced
482:49f5aef41157 483:621229427cba
38 #define NGX_LOG_DEBUG_LAST NGX_LOG_DEBUG_IMAP 38 #define NGX_LOG_DEBUG_LAST NGX_LOG_DEBUG_IMAP
39 #define NGX_LOG_DEBUG_CONNECTION 0x80000000 39 #define NGX_LOG_DEBUG_CONNECTION 0x80000000
40 #define NGX_LOG_DEBUG_ALL 0x7ffffff0 40 #define NGX_LOG_DEBUG_ALL 0x7ffffff0
41 41
42 42
43 typedef u_char *(*ngx_log_handler_pt) (void *ctx, u_char *buf, size_t len); 43 typedef u_char *(*ngx_log_handler_pt) (ngx_log_t *log, u_char *buf, size_t len);
44 44
45 45
46 struct ngx_log_s { 46 struct ngx_log_s {
47 ngx_uint_t log_level; 47 ngx_uint_t log_level;
48 ngx_open_file_t *file; 48 ngx_open_file_t *file;
49
50 ngx_uint_t connection;
51
52 ngx_log_handler_pt handler;
49 void *data; 53 void *data;
50 ngx_log_handler_pt handler; 54
55 /*
56 * we declare "action" as "char *" because the actions are usually
57 * the static strings and in the "u_char *" case we have to override
58 * their types all the time
59 */
60
61 char *action;
51 }; 62 };
52 63
53 64
54 #define NGX_MAX_ERROR_STR 2048 65 #define NGX_MAX_ERROR_STR 2048
55 66
58 69
59 #if (NGX_HAVE_GCC_VARIADIC_MACROS) 70 #if (NGX_HAVE_GCC_VARIADIC_MACROS)
60 71
61 #define NGX_HAVE_VARIADIC_MACROS 1 72 #define NGX_HAVE_VARIADIC_MACROS 1
62 73
63 #define ngx_log_error(level, log, args...) \ 74 #define ngx_log_error(level, log, args...) \
64 if (log->log_level >= level) ngx_log_error_core(level, log, args) 75 if (log->log_level >= level) ngx_log_error_core(level, log, args)
65 76
66 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, 77 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
67 const char *fmt, ...); 78 const char *fmt, ...);
68 79
80 #define ngx_log_debug(level, log, args...) \
81 if (log->log_level & level) \
82 ngx_log_error_core(NGX_LOG_DEBUG, log, args)
83
69 /*********************************/ 84 /*********************************/
70 85
71 #elif (NGX_HAVE_C99_VARIADIC_MACROS) 86 #elif (NGX_HAVE_C99_VARIADIC_MACROS)
72 87
73 #define NGX_HAVE_VARIADIC_MACROS 1 88 #define NGX_HAVE_VARIADIC_MACROS 1
74 89
75 #define ngx_log_error(level, log, ...) \ 90 #define ngx_log_error(level, log, ...) \
76 if (log->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__) 91 if (log->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
77 92
78 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, 93 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
79 const char *fmt, ...); 94 const char *fmt, ...);
95
96 #define ngx_log_debug(level, log, ...) \
97 if (log->log_level & level) \
98 ngx_log_error_core(NGX_LOG_DEBUG, log, __VA_ARGS__)
80 99
81 /*********************************/ 100 /*********************************/
82 101
83 #else /* NO VARIADIC MACROS */ 102 #else /* NO VARIADIC MACROS */
84 103
98 117
99 #if (NGX_DEBUG) 118 #if (NGX_DEBUG)
100 119
101 #if (NGX_HAVE_VARIADIC_MACROS) 120 #if (NGX_HAVE_VARIADIC_MACROS)
102 121
103 #define ngx_log_debug0(level, log, err, fmt) \ 122 #define ngx_log_debug0 ngx_log_debug
104 if (log->log_level & level) \ 123 #define ngx_log_debug1 ngx_log_debug
105 ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt) 124 #define ngx_log_debug2 ngx_log_debug
106 125 #define ngx_log_debug3 ngx_log_debug
107 #define ngx_log_debug1(level, log, err, fmt, arg1) \ 126 #define ngx_log_debug4 ngx_log_debug
108 if (log->log_level & level) \ 127 #define ngx_log_debug5 ngx_log_debug
109 ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, arg1) 128 #define ngx_log_debug6 ngx_log_debug
110 129 #define ngx_log_debug7 ngx_log_debug
111 #define ngx_log_debug2(level, log, err, fmt, arg1, arg2) \ 130 #define ngx_log_debug8 ngx_log_debug
112 if (log->log_level & level) \
113 ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, arg1, arg2)
114
115 #define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3) \
116 if (log->log_level & level) \
117 ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, arg1, arg2, arg3)
118
119 #define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \
120 if (log->log_level & level) \
121 ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, arg1, arg2, arg3, arg4)
122
123 #define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \
124 if (log->log_level & level) \
125 ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, \
126 arg1, arg2, arg3, arg4, arg5)
127
128 #define ngx_log_debug6(level, log, err, fmt, \
129 arg1, arg2, arg3, arg4, arg5, arg6) \
130 if (log->log_level & level) \
131 ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, \
132 arg1, arg2, arg3, arg4, arg5, arg6)
133
134 #define ngx_log_debug7(level, log, err, fmt, \
135 arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
136 if (log->log_level & level) \
137 ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, \
138 arg1, arg2, arg3, arg4, arg5, arg6, arg7)
139 131
140 #else /* NO VARIADIC MACROS */ 132 #else /* NO VARIADIC MACROS */
141 133
142 #define ngx_log_debug0(level, log, err, fmt) \ 134 #define ngx_log_debug0(level, log, err, fmt) \
143 if (log->log_level & level) \ 135 if (log->log_level & level) \
144 ngx_log_debug_core(log, err, fmt) 136 ngx_log_debug_core(log, err, fmt)
145 137
146 #define ngx_log_debug1(level, log, err, fmt, arg1) \ 138 #define ngx_log_debug1(level, log, err, fmt, arg1) \
147 if (log->log_level & level) \ 139 if (log->log_level & level) \
148 ngx_log_debug_core(log, err, fmt, arg1) 140 ngx_log_debug_core(log, err, fmt, arg1)
149 141
150 #define ngx_log_debug2(level, log, err, fmt, arg1, arg2) \ 142 #define ngx_log_debug2(level, log, err, fmt, arg1, arg2) \
151 if (log->log_level & level) \ 143 if (log->log_level & level) \
152 ngx_log_debug_core(log, err, fmt, arg1, arg2) 144 ngx_log_debug_core(log, err, fmt, arg1, arg2)
153 145
154 #define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3) \ 146 #define ngx_log_debug3(level, log, err, fmt, arg1, arg2, arg3) \
155 if (log->log_level & level) \ 147 if (log->log_level & level) \
156 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3) 148 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3)
157 149
158 #define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \ 150 #define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) \
159 if (log->log_level & level) \ 151 if (log->log_level & level) \
160 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4) 152 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4)
161 153
162 #define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \ 154 #define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) \
163 if (log->log_level & level) \ 155 if (log->log_level & level) \
164 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5) 156 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5)
165 157
166 #define ngx_log_debug6(level, log, err, fmt, \ 158 #define ngx_log_debug6(level, log, err, fmt, \
167 arg1, arg2, arg3, arg4, arg5, arg6) \ 159 arg1, arg2, arg3, arg4, arg5, arg6) \
168 if (log->log_level & level) \ 160 if (log->log_level & level) \
169 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6) 161 ngx_log_debug_core(log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
170 162
171 #define ngx_log_debug7(level, log, err, fmt, \ 163 #define ngx_log_debug7(level, log, err, fmt, \
172 arg1, arg2, arg3, arg4, arg5, arg6, arg7) \ 164 arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
173 if (log->log_level & level) \ 165 if (log->log_level & level) \
174 ngx_log_debug_core(log, err, fmt, \ 166 ngx_log_debug_core(log, err, fmt, \
175 arg1, arg2, arg3, arg4, arg5, arg6, arg7) 167 arg1, arg2, arg3, arg4, arg5, arg6, arg7)
168
169 #define ngx_log_debug8(level, log, err, fmt, \
170 arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
171 if (log->log_level & level) \
172 ngx_log_debug_core(log, err, fmt, \
173 arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
176 174
177 #endif 175 #endif
178 176
179 #else /* NO NGX_DEBUG */ 177 #else /* NO NGX_DEBUG */
180 178
185 #define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4) 183 #define ngx_log_debug4(level, log, err, fmt, arg1, arg2, arg3, arg4)
186 #define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5) 184 #define ngx_log_debug5(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5)
187 #define ngx_log_debug6(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6) 185 #define ngx_log_debug6(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, arg6)
188 #define ngx_log_debug7(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, \ 186 #define ngx_log_debug7(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, \
189 arg6, arg7) 187 arg6, arg7)
188 #define ngx_log_debug8(level, log, err, fmt, arg1, arg2, arg3, arg4, arg5, \
189 arg6, arg7, arg8)
190 190
191 #endif 191 #endif
192 192
193 /*********************************/ 193 /*********************************/
194 194