Mercurial > hg > nginx
comparison src/core/ngx_log.c @ 234:cd71b95716b4
nginx-0.0.1-2004-01-20-23:40:08 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 20 Jan 2004 20:40:08 +0000 |
parents | 03c54b6d7a6f |
children | 6bd5d25b6744 |
comparison
equal
deleted
inserted
replaced
233:4eaafcd57be7 | 234:cd71b95716b4 |
---|---|
273 } | 273 } |
274 | 274 |
275 | 275 |
276 static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 276 static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
277 { | 277 { |
278 ngx_str_t *value; | |
279 | |
280 value = cf->args->elts; | |
281 | |
282 if (value[1].len == 6 && ngx_strcmp(value[1].data, "stderr") == 0) { | |
283 cf->cycle->log->file = &ngx_stderr; | |
284 | |
285 } else { | |
286 cf->cycle->log->file->name = value[1]; | |
287 } | |
288 | |
289 return ngx_set_error_log_levels(cf, cf->cycle->log); | |
290 } | |
291 | |
292 | |
293 char *ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log) | |
294 { | |
278 ngx_int_t i, n, d; | 295 ngx_int_t i, n, d; |
279 ngx_str_t *value; | 296 ngx_str_t *value; |
280 | 297 |
281 value = cf->args->elts; | 298 value = cf->args->elts; |
282 | 299 |
283 if (value[1].len == 6 && ngx_strcmp(value[1].data, "stderr") == 0) { | |
284 cf->cycle->log->file = &ngx_stderr; | |
285 | |
286 } else { | |
287 cf->cycle->log->file->name = value[1]; | |
288 } | |
289 | |
290 for (i = 2; i < cf->args->nelts; i++) { | 300 for (i = 2; i < cf->args->nelts; i++) { |
291 | 301 |
292 for (n = 1; n < NGX_LOG_DEBUG; n++) { | 302 for (n = 1; n < NGX_LOG_DEBUG; n++) { |
293 if (ngx_strcmp(value[i].data, err_levels[n]) == 0) { | 303 if (ngx_strcmp(value[i].data, err_levels[n]) == 0) { |
294 | 304 |
295 if (cf->cycle->log->log_level != 0) { | 305 if (log->log_level != 0) { |
296 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 306 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
297 "invalid log level \"%s\"", | 307 "invalid log level \"%s\"", |
298 value[i].data); | 308 value[i].data); |
299 return NGX_CONF_ERROR; | 309 return NGX_CONF_ERROR; |
300 } | 310 } |
301 | 311 |
302 cf->cycle->log->log_level = n; | 312 log->log_level = n; |
303 continue; | 313 continue; |
304 } | 314 } |
305 } | 315 } |
306 | 316 |
307 d = NGX_LOG_DEBUG_FIRST; | 317 d = NGX_LOG_DEBUG_FIRST; |
308 for (n = 0; n < /* STUB */ 4; n++) { | 318 for (n = 0; n < /* STUB */ 4; n++) { |
309 if (ngx_strcmp(value[i].data, debug_levels[n]) == 0) { | 319 if (ngx_strcmp(value[i].data, debug_levels[n]) == 0) { |
310 if (cf->cycle->log->log_level & ~NGX_LOG_DEBUG_ALL) { | 320 if (log->log_level & ~NGX_LOG_DEBUG_ALL) { |
311 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 321 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
312 "invalid log level \"%s\"", | 322 "invalid log level \"%s\"", |
313 value[i].data); | 323 value[i].data); |
314 return NGX_CONF_ERROR; | 324 return NGX_CONF_ERROR; |
315 } | 325 } |
316 | 326 |
317 cf->cycle->log->log_level |= d; | 327 log->log_level |= d; |
318 } | 328 } |
319 | 329 |
320 d <<= 1; | 330 d <<= 1; |
321 } | 331 } |
322 | 332 |
323 | 333 |
324 if (cf->cycle->log->log_level == 0) { | 334 if (log->log_level == 0) { |
325 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 335 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
326 "invalid log level \"%s\"", value[i].data); | 336 "invalid log level \"%s\"", value[i].data); |
327 return NGX_CONF_ERROR; | 337 return NGX_CONF_ERROR; |
328 } | 338 } |
329 } | 339 } |