Mercurial > hg > nginx-vendor-0-6
comparison src/core/ngx_log.c @ 52:0d75d65c642f NGINX_0_1_26
nginx 0.1.26
*) Change: the invalid client header lines are now ignored and logged
at the info level.
*) Change: the server name is also logged in error log.
*) Feature: the ngx_http_auth_basic_module module and the auth_basic
and auth_basic_user_file directives.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 22 Mar 2005 00:00:00 +0300 |
parents | 72eb30262aac |
children | b55cbf18157e |
comparison
equal
deleted
inserted
replaced
51:43f383e47efc | 52:0d75d65c642f |
---|---|
56 "debug_http", "debug_imap" | 56 "debug_http", "debug_imap" |
57 }; | 57 }; |
58 | 58 |
59 | 59 |
60 #if (NGX_HAVE_VARIADIC_MACROS) | 60 #if (NGX_HAVE_VARIADIC_MACROS) |
61 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, | 61 |
62 const char *fmt, ...) | 62 void |
63 #else | 63 ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, |
64 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, | 64 const char *fmt, ...) |
65 const char *fmt, va_list args) | 65 |
66 #else | |
67 | |
68 void | |
69 ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, | |
70 const char *fmt, va_list args) | |
71 | |
66 #endif | 72 #endif |
67 { | 73 { |
68 #if (NGX_HAVE_VARIADIC_MACROS) | 74 #if (NGX_HAVE_VARIADIC_MACROS) |
69 va_list args; | 75 va_list args; |
70 #endif | 76 #endif |
142 | 148 |
143 ngx_log_write(log, errstr, p - errstr); | 149 ngx_log_write(log, errstr, p - errstr); |
144 } | 150 } |
145 | 151 |
146 | 152 |
147 static void ngx_log_write(ngx_log_t *log, u_char *errstr, size_t len) | 153 static void |
154 ngx_log_write(ngx_log_t *log, u_char *errstr, size_t len) | |
148 { | 155 { |
149 #if (NGX_WIN32) | 156 #if (NGX_WIN32) |
150 u_long written; | 157 u_long written; |
151 | 158 |
152 if (len >= NGX_MAX_ERROR_STR - 1) { | 159 if (len >= NGX_MAX_ERROR_STR - 1) { |
178 } | 185 } |
179 | 186 |
180 | 187 |
181 #if !(NGX_HAVE_VARIADIC_MACROS) | 188 #if !(NGX_HAVE_VARIADIC_MACROS) |
182 | 189 |
183 void ngx_log_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, | 190 void ngx_cdecl |
184 const char *fmt, ...) | 191 ngx_log_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, |
192 const char *fmt, ...) | |
185 { | 193 { |
186 va_list args; | 194 va_list args; |
187 | 195 |
188 if (log->log_level >= level) { | 196 if (log->log_level >= level) { |
189 va_start(args, fmt); | 197 va_start(args, fmt); |
191 va_end(args); | 199 va_end(args); |
192 } | 200 } |
193 } | 201 } |
194 | 202 |
195 | 203 |
196 void ngx_log_debug_core(ngx_log_t *log, ngx_err_t err, const char *fmt, ...) | 204 void ngx_cdecl |
205 ngx_log_debug_core(ngx_log_t *log, ngx_err_t err, const char *fmt, ...) | |
197 { | 206 { |
198 va_list args; | 207 va_list args; |
199 | 208 |
200 va_start(args, fmt); | 209 va_start(args, fmt); |
201 ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, args); | 210 ngx_log_error_core(NGX_LOG_DEBUG, log, err, fmt, args); |
203 } | 212 } |
204 | 213 |
205 #endif | 214 #endif |
206 | 215 |
207 | 216 |
208 ngx_log_t *ngx_log_init(void) | 217 ngx_log_t * |
218 ngx_log_init(void) | |
209 { | 219 { |
210 ngx_log.file = &ngx_stderr; | 220 ngx_log.file = &ngx_stderr; |
211 ngx_log.log_level = NGX_LOG_NOTICE; | 221 ngx_log.log_level = NGX_LOG_NOTICE; |
212 | 222 |
213 #if (NGX_WIN32) | 223 #if (NGX_WIN32) |
238 | 248 |
239 return &ngx_log; | 249 return &ngx_log; |
240 } | 250 } |
241 | 251 |
242 | 252 |
243 ngx_log_t *ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_array_t *args) | 253 ngx_log_t * |
254 ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_array_t *args) | |
244 { | 255 { |
245 ngx_log_t *log; | 256 ngx_log_t *log; |
246 ngx_str_t *value, *name; | 257 ngx_str_t *value, *name; |
247 | 258 |
248 if (args) { | 259 if (args) { |
265 | 276 |
266 return log; | 277 return log; |
267 } | 278 } |
268 | 279 |
269 | 280 |
270 char *ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log) | 281 char * |
282 ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log) | |
271 { | 283 { |
272 ngx_uint_t i, n, d; | 284 ngx_uint_t i, n, d; |
273 ngx_str_t *value; | 285 ngx_str_t *value; |
274 | 286 |
275 value = cf->args->elts; | 287 value = cf->args->elts; |
318 | 330 |
319 return NGX_CONF_OK; | 331 return NGX_CONF_OK; |
320 } | 332 } |
321 | 333 |
322 | 334 |
323 static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 335 static char * |
336 ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
324 { | 337 { |
325 ngx_str_t *value; | 338 ngx_str_t *value; |
326 | 339 |
327 value = cf->args->elts; | 340 value = cf->args->elts; |
328 | 341 |