Mercurial > hg > nginx
comparison src/core/ngx_log.c @ 571:458b6c3fea65 release-0.3.7
nginx-0.3.7-RELEASE import
*) Feature: the "access_log" supports the "buffer=" parameter.
*) Bugfix: nginx could not be built on platforms different from i386,
amd64, sparc, and ppc; the bug had appeared in 0.3.2.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 27 Oct 2005 15:46:13 +0000 |
parents | b09ee85d0ac8 |
children | 4d9ea73a627a |
comparison
equal
deleted
inserted
replaced
570:2cdf120d8970 | 571:458b6c3fea65 |
---|---|
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 |