Mercurial > hg > nginx
comparison src/mail/ngx_mail_core_module.c @ 6130:fc99323a3d79
Mail: error_log support.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Fri, 20 Feb 2015 15:31:37 +0300 |
parents | b2920b517490 |
children | bf1655ae9a1c |
comparison
equal
deleted
inserted
replaced
6129:187aa751ad62 | 6130:fc99323a3d79 |
---|---|
19 void *conf); | 19 void *conf); |
20 static char *ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, | 20 static char *ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, |
21 void *conf); | 21 void *conf); |
22 static char *ngx_mail_core_protocol(ngx_conf_t *cf, ngx_command_t *cmd, | 22 static char *ngx_mail_core_protocol(ngx_conf_t *cf, ngx_command_t *cmd, |
23 void *conf); | 23 void *conf); |
24 static char *ngx_mail_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, | |
25 void *conf); | |
24 static char *ngx_mail_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, | 26 static char *ngx_mail_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, |
25 void *conf); | 27 void *conf); |
26 | 28 |
27 | 29 |
28 static ngx_conf_deprecated_t ngx_conf_deprecated_so_keepalive = { | 30 static ngx_conf_deprecated_t ngx_conf_deprecated_so_keepalive = { |
71 { ngx_string("server_name"), | 73 { ngx_string("server_name"), |
72 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1, | 74 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1, |
73 ngx_conf_set_str_slot, | 75 ngx_conf_set_str_slot, |
74 NGX_MAIL_SRV_CONF_OFFSET, | 76 NGX_MAIL_SRV_CONF_OFFSET, |
75 offsetof(ngx_mail_core_srv_conf_t, server_name), | 77 offsetof(ngx_mail_core_srv_conf_t, server_name), |
78 NULL }, | |
79 | |
80 { ngx_string("error_log"), | |
81 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE, | |
82 ngx_mail_core_error_log, | |
83 NGX_MAIL_SRV_CONF_OFFSET, | |
84 0, | |
76 NULL }, | 85 NULL }, |
77 | 86 |
78 { ngx_string("resolver"), | 87 { ngx_string("resolver"), |
79 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE, | 88 NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE, |
80 ngx_mail_core_resolver, | 89 ngx_mail_core_resolver, |
159 | 168 |
160 /* | 169 /* |
161 * set by ngx_pcalloc(): | 170 * set by ngx_pcalloc(): |
162 * | 171 * |
163 * cscf->protocol = NULL; | 172 * cscf->protocol = NULL; |
173 * cscf->error_log = NULL; | |
164 */ | 174 */ |
165 | 175 |
166 cscf->timeout = NGX_CONF_UNSET_MSEC; | 176 cscf->timeout = NGX_CONF_UNSET_MSEC; |
167 cscf->resolver_timeout = NGX_CONF_UNSET_MSEC; | 177 cscf->resolver_timeout = NGX_CONF_UNSET_MSEC; |
168 cscf->so_keepalive = NGX_CONF_UNSET; | 178 cscf->so_keepalive = NGX_CONF_UNSET; |
198 if (conf->protocol == NULL) { | 208 if (conf->protocol == NULL) { |
199 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 209 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, |
200 "unknown mail protocol for server in %s:%ui", | 210 "unknown mail protocol for server in %s:%ui", |
201 conf->file_name, conf->line); | 211 conf->file_name, conf->line); |
202 return NGX_CONF_ERROR; | 212 return NGX_CONF_ERROR; |
213 } | |
214 | |
215 if (conf->error_log == NULL) { | |
216 if (prev->error_log) { | |
217 conf->error_log = prev->error_log; | |
218 } else { | |
219 conf->error_log = &cf->cycle->new_log; | |
220 } | |
203 } | 221 } |
204 | 222 |
205 ngx_conf_merge_ptr_value(conf->resolver, prev->resolver, NULL); | 223 ngx_conf_merge_ptr_value(conf->resolver, prev->resolver, NULL); |
206 | 224 |
207 return NGX_CONF_OK; | 225 return NGX_CONF_OK; |
599 return NGX_CONF_ERROR; | 617 return NGX_CONF_ERROR; |
600 } | 618 } |
601 | 619 |
602 | 620 |
603 static char * | 621 static char * |
622 ngx_mail_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
623 { | |
624 ngx_mail_core_srv_conf_t *cscf = conf; | |
625 | |
626 return ngx_log_set_log(cf, &cscf->error_log); | |
627 } | |
628 | |
629 | |
630 static char * | |
604 ngx_mail_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 631 ngx_mail_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
605 { | 632 { |
606 ngx_mail_core_srv_conf_t *cscf = conf; | 633 ngx_mail_core_srv_conf_t *cscf = conf; |
607 | 634 |
608 ngx_str_t *value; | 635 ngx_str_t *value; |