mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
show -t results on stderr
This commit is contained in:
parent
d7fe640672
commit
1153aa6465
@ -191,8 +191,6 @@ static char **ngx_os_environ;
|
|||||||
int ngx_cdecl
|
int ngx_cdecl
|
||||||
main(int argc, char *const *argv)
|
main(int argc, char *const *argv)
|
||||||
{
|
{
|
||||||
char *p;
|
|
||||||
ssize_t n;
|
|
||||||
ngx_int_t i;
|
ngx_int_t i;
|
||||||
ngx_log_t *log;
|
ngx_log_t *log;
|
||||||
ngx_cycle_t *cycle, init_cycle;
|
ngx_cycle_t *cycle, init_cycle;
|
||||||
@ -243,29 +241,14 @@ main(int argc, char *const *argv)
|
|||||||
|
|
||||||
if (ngx_show_version) {
|
if (ngx_show_version) {
|
||||||
|
|
||||||
p = "nginx version: " NGINX_VER CRLF;
|
ngx_log_stderr("nginx version: " NGINX_VER);
|
||||||
n = sizeof("nginx version: " NGINX_VER CRLF) - 1;
|
|
||||||
|
|
||||||
if (ngx_write_fd(ngx_stderr_fileno, p, n) != n) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ngx_show_configure) {
|
if (ngx_show_configure) {
|
||||||
#ifdef NGX_COMPILER
|
#ifdef NGX_COMPILER
|
||||||
p = "built by " NGX_COMPILER CRLF;
|
ngx_log_stderr("built by " NGX_COMPILER);
|
||||||
n = sizeof("built by " NGX_COMPILER CRLF) - 1;
|
|
||||||
|
|
||||||
if (ngx_write_fd(ngx_stderr_fileno, p, n) != n) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
p = "configure arguments: " NGX_CONFIGURE CRLF;
|
ngx_log_stderr("configure arguments: " NGX_CONFIGURE);
|
||||||
n = sizeof("configure arguments :" NGX_CONFIGURE CRLF) - 1;
|
|
||||||
|
|
||||||
if (ngx_write_fd(ngx_stderr_fileno, p, n) != n) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ngx_test_config) {
|
if (!ngx_test_config) {
|
||||||
@ -301,18 +284,16 @@ main(int argc, char *const *argv)
|
|||||||
cycle = ngx_init_cycle(&init_cycle);
|
cycle = ngx_init_cycle(&init_cycle);
|
||||||
if (cycle == NULL) {
|
if (cycle == NULL) {
|
||||||
if (ngx_test_config) {
|
if (ngx_test_config) {
|
||||||
ngx_log_error(NGX_LOG_EMERG, log, 0,
|
ngx_log_stderr("the configuration file %s test failed",
|
||||||
"the configuration file %s test failed",
|
init_cycle.conf_file.data);
|
||||||
init_cycle.conf_file.data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_test_config) {
|
if (ngx_test_config) {
|
||||||
ngx_log_error(NGX_LOG_INFO, log, 0,
|
ngx_log_stderr("the configuration file %s was tested successfully",
|
||||||
"the configuration file %s was tested successfully",
|
cycle->conf_file.data);
|
||||||
cycle->conf_file.data);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,9 +270,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_test_config) {
|
if (ngx_test_config) {
|
||||||
ngx_log_error(NGX_LOG_INFO, log, 0,
|
ngx_log_stderr("the configuration file %s syntax is ok",
|
||||||
"the configuration file %s syntax is ok",
|
cycle->conf_file.data);
|
||||||
cycle->conf_file.data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -190,6 +190,27 @@ ngx_log_abort(ngx_err_t err, const char *text, void *param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ngx_cdecl
|
||||||
|
ngx_log_stderr(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
u_char *p;
|
||||||
|
va_list args;
|
||||||
|
u_char errstr[NGX_MAX_ERROR_STR];
|
||||||
|
|
||||||
|
va_start(args, fmt);
|
||||||
|
p = ngx_vsnprintf(errstr, NGX_MAX_ERROR_STR, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
if (p > errstr + NGX_MAX_ERROR_STR - NGX_LINEFEED_SIZE) {
|
||||||
|
p = errstr + NGX_MAX_ERROR_STR - NGX_LINEFEED_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngx_linefeed(p);
|
||||||
|
|
||||||
|
(void) ngx_write_fd(ngx_stderr_fileno, errstr, p - errstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ngx_log_t *
|
ngx_log_t *
|
||||||
ngx_log_init(void)
|
ngx_log_init(void)
|
||||||
{
|
{
|
||||||
|
@ -199,6 +199,7 @@ ngx_log_t *ngx_log_init(void);
|
|||||||
ngx_log_t *ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_array_t *args);
|
ngx_log_t *ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_array_t *args);
|
||||||
char *ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log);
|
char *ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log);
|
||||||
void ngx_log_abort(ngx_err_t err, const char *text, void *param);
|
void ngx_log_abort(ngx_err_t err, const char *text, void *param);
|
||||||
|
void ngx_cdecl ngx_log_stderr(const char *fmt, ...);
|
||||||
|
|
||||||
|
|
||||||
extern ngx_module_t ngx_errlog_module;
|
extern ngx_module_t ngx_errlog_module;
|
||||||
|
Loading…
Reference in New Issue
Block a user