Mercurial > hg > nginx-vendor-0-8
comparison src/core/ngx_log.c @ 120:e85dca77c46a NGINX_0_3_7
nginx 0.3.7
*) Feature: the "access_log" supports the "buffer=" parameter.
*) Bugfix: nginx could not be built on platforms different from i386,
amd64, sparc É ppc; bug appeared in 0.3.2.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 27 Oct 2005 00:00:00 +0400 |
parents | 71c46860eb55 |
children | df17fbafec8f |
comparison
equal
deleted
inserted
replaced
119:85abc07cafba | 120:e85dca77c46a |
---|---|
6 | 6 |
7 #include <ngx_config.h> | 7 #include <ngx_config.h> |
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
9 | 9 |
10 | 10 |
11 static void ngx_log_write(ngx_log_t *log, u_char *errstr, size_t len); | |
12 static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); | 11 static char *ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
13 | 12 |
14 | 13 |
15 static ngx_command_t ngx_errlog_commands[] = { | 14 static ngx_command_t ngx_errlog_commands[] = { |
16 | 15 |
150 | 149 |
151 if (level != NGX_LOG_DEBUG && log->handler) { | 150 if (level != NGX_LOG_DEBUG && log->handler) { |
152 p = log->handler(log, p, last - p); | 151 p = log->handler(log, p, last - p); |
153 } | 152 } |
154 | 153 |
155 ngx_log_write(log, errstr, p - errstr); | 154 if (p > last - NGX_LINEFEED_SIZE) { |
156 } | 155 p = last - NGX_LINEFEED_SIZE; |
157 | 156 } |
158 | 157 |
159 static void | 158 ngx_linefeed(p); |
160 ngx_log_write(ngx_log_t *log, u_char *errstr, size_t len) | 159 |
161 { | 160 ngx_write_fd(log->file->fd, errstr, p - errstr); |
162 #if (NGX_WIN32) | |
163 u_long written; | |
164 | |
165 if (len >= NGX_MAX_ERROR_STR - 1) { | |
166 len = NGX_MAX_ERROR_STR - 2; | |
167 } | |
168 | |
169 errstr[len++] = CR; | |
170 errstr[len++] = LF; | |
171 | |
172 WriteFile(log->file->fd, errstr, len, &written, NULL); | |
173 | |
174 #if 0 | |
175 if (WriteFile(log->file->fd, errstr, len, &written, NULL) == 0) { | |
176 ngx_message_box("nginx", MB_OK, ngx_errno, "WriteFile() failed"); | |
177 } | |
178 #endif | |
179 | |
180 #else | |
181 | |
182 if (len == NGX_MAX_ERROR_STR) { | |
183 len--; | |
184 } | |
185 | |
186 errstr[len++] = LF; | |
187 | |
188 (void) write(log->file->fd, errstr, len); | |
189 | |
190 #endif | |
191 } | 161 } |
192 | 162 |
193 | 163 |
194 #if !(NGX_HAVE_VARIADIC_MACROS) | 164 #if !(NGX_HAVE_VARIADIC_MACROS) |
195 | 165 |