diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-04-19 16:06:09 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-04-19 16:06:09 +0000 |
commit | 1153aa646573103baa9868f668eb8a562ec8cf63 (patch) | |
tree | 1fde80940516fd831c54a04328ab01b5621d9bbb /src/core/ngx_log.c | |
parent | d7fe6406720e5d5307dc1164f5f95c68f7b9fe7b (diff) | |
download | nginx-1153aa646573103baa9868f668eb8a562ec8cf63.tar.gz nginx-1153aa646573103baa9868f668eb8a562ec8cf63.zip |
show -t results on stderr
Diffstat (limited to 'src/core/ngx_log.c')
-rw-r--r-- | src/core/ngx_log.c | 21 |
1 files changed, 21 insertions, 0 deletions
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) { |