Mercurial > hg > nginx
comparison src/http/ngx_http_log_handler.c @ 409:8ac40cae79f0
nginx-0.0.10-2004-08-29-07:55:41 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 29 Aug 2004 03:55:41 +0000 |
parents | 5659d773cfa8 |
children | 3c56e834be46 |
comparison
equal
deleted
inserted
replaced
408:d6e2b445c1b8 | 409:8ac40cae79f0 |
---|---|
10 static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf, | 10 static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf, |
11 uintptr_t data); | 11 uintptr_t data); |
12 static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, | 12 static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, |
13 uintptr_t data); | 13 uintptr_t data); |
14 static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf, | 14 static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf, |
15 uintptr_t data); | |
16 static u_char *ngx_http_log_msec(ngx_http_request_t *r, u_char *buf, | |
15 uintptr_t data); | 17 uintptr_t data); |
16 static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf, | 18 static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf, |
17 uintptr_t data); | 19 uintptr_t data); |
18 static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf, | 20 static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf, |
19 uintptr_t data); | 21 uintptr_t data); |
104 { ngx_string("addr"), INET_ADDRSTRLEN - 1, ngx_http_log_addr }, | 106 { ngx_string("addr"), INET_ADDRSTRLEN - 1, ngx_http_log_addr }, |
105 { ngx_string("conn"), NGX_INT32_LEN, ngx_http_log_connection }, | 107 { ngx_string("conn"), NGX_INT32_LEN, ngx_http_log_connection }, |
106 { ngx_string("pipe"), 1, ngx_http_log_pipe }, | 108 { ngx_string("pipe"), 1, ngx_http_log_pipe }, |
107 { ngx_string("time"), sizeof("28/Sep/1970:12:00:00") - 1, | 109 { ngx_string("time"), sizeof("28/Sep/1970:12:00:00") - 1, |
108 ngx_http_log_time }, | 110 ngx_http_log_time }, |
111 { ngx_string("msec"), TIME_T_LEN + 4, ngx_http_log_msec }, | |
109 { ngx_string("request"), 0, ngx_http_log_request }, | 112 { ngx_string("request"), 0, ngx_http_log_request }, |
110 { ngx_string("status"), 3, ngx_http_log_status }, | 113 { ngx_string("status"), 3, ngx_http_log_status }, |
111 { ngx_string("length"), NGX_OFF_T_LEN, ngx_http_log_length }, | 114 { ngx_string("length"), NGX_OFF_T_LEN, ngx_http_log_length }, |
112 { ngx_string("apache_length"), NGX_OFF_T_LEN, ngx_http_log_apache_length }, | 115 { ngx_string("apache_length"), NGX_OFF_T_LEN, ngx_http_log_apache_length }, |
113 { ngx_string("i"), NGX_HTTP_LOG_ARG, ngx_http_log_header_in }, | 116 { ngx_string("i"), NGX_HTTP_LOG_ARG, ngx_http_log_header_in }, |
220 static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf, | 223 static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf, |
221 uintptr_t data) | 224 uintptr_t data) |
222 { | 225 { |
223 return ngx_cpymem(buf, ngx_cached_http_log_time.data, | 226 return ngx_cpymem(buf, ngx_cached_http_log_time.data, |
224 ngx_cached_http_log_time.len); | 227 ngx_cached_http_log_time.len); |
228 } | |
229 | |
230 | |
231 static u_char *ngx_http_log_msec(ngx_http_request_t *r, u_char *buf, | |
232 uintptr_t data) | |
233 { | |
234 struct timeval tv; | |
235 | |
236 ngx_gettimeofday(&tv); | |
237 | |
238 return buf + ngx_snprintf((char *) buf, TIME_T_LEN + 5, "%ld.%03ld", | |
239 tv.tv_sec, tv.tv_usec / 1000); | |
225 } | 240 } |
226 | 241 |
227 | 242 |
228 static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf, | 243 static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf, |
229 uintptr_t data) | 244 uintptr_t data) |