From 1153aa646573103baa9868f668eb8a562ec8cf63 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Sun, 19 Apr 2009 16:06:09 +0000 Subject: show -t results on stderr --- src/core/ngx_log.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/core/ngx_log.c') diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c index 8c266b77d..35a24172e 100644 --- a/src/core/ngx_log.c +++ b/src/core/ngx_log.c @@ -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_init(void) { -- cgit