static char * ngx_tcp_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_tcp_core_main_conf_t *cmcf = conf; ngx_str_t *value, name; if (cmcf->error_log) { return "is duplicate"; } value = cf->args->elts; if (ngx_strcmp(value[1].data, "stderr") == 0) { ngx_str_null(&name); } else { name = value[1]; } cmcf->error_log = ngx_log_create(cf->cycle, &name); if (cmcf->error_log == NULL) { return NGX_CONF_ERROR; } if (cf->args->nelts == 2) { cmcf->error_log->log_level = NGX_LOG_ERR; return NGX_CONF_OK; } return ngx_log_set_levels(cf, cmcf->error_log); }
static char * ngx_backtrace_files(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_str_t file, *value; ngx_log_t *log; ngx_backtrace_conf_t *bcf; bcf = (ngx_backtrace_conf_t *) ngx_get_conf(cf->cycle->conf_ctx, ngx_backtrace_module); value = cf->args->elts; file = value[1]; if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) { return NGX_CONF_ERROR; } log = ngx_log_create(cf->cycle, &file); if (log == NULL) { return NGX_CONF_ERROR; } bcf->log = log; return NGX_CONF_OK; }
static char * ngx_http_sml_sml_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_http_sml_loc_conf_t *slcf = conf; ngx_http_sml_log_conf_t *lgcf = slcf->log_conf; ngx_str_t *value, name; if (lgcf) { return "is duplicate"; } lgcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_sml_log_conf_t)); if (lgcf == NULL) { return NGX_CONF_ERROR; } /* set by pcalloc lgcf->log_tail = 0 */ slcf->log_conf = lgcf; value = cf->args->elts; if (ngx_strcmp(value[1].data, "stderr") == 0) { ngx_str_null(&name); } else { name = value[1]; } lgcf->log = ngx_log_create(cf->cycle, &name); if (lgcf->log == NULL) { return NGX_CONF_ERROR; } return ngx_sml_log_set(cf, slcf->log_conf); }
static char * ngx_http_tfs_tackle_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_http_tfs_srv_conf_t *tscf = conf; ngx_str_t *value; if (tscf->log != NULL) { return "is duplicate"; } value = cf->args->elts; tscf->log = ngx_log_create(cf->cycle, &value[1]); if (tscf->log == NULL) { return NGX_CONF_ERROR; } if (cf->args->nelts == 2) { tscf->log->log_level = NGX_LOG_INFO; } return ngx_log_set_levels(cf, tscf->log); }
static ngx_int_t ngx_http_sml_preinit(ngx_conf_t *cf) { ngx_str_t name = ngx_string(DEFAULT_LOG); ngx_log_t *log; log = ngx_log_create(cf->cycle, &name); if (log == NULL) { return NGX_ERROR ; } log->log_level = DEFAULT_LEVEL; log->handler = ngx_http_sml_log_error; default_log = ngx_pcalloc(cf->pool, sizeof(ngx_http_sml_log_conf_t)); if (default_log == NULL) { return NGX_ERROR; } /* set by pcalloc default_log->log_tail = 0 */ default_log->log = log; return NGX_OK; }