Mercurial > hg > nginx
comparison src/http/ngx_http_log_handler.c @ 356:2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 16 Jun 2004 15:32:11 +0000 |
parents | 5cfd65b8b0a7 |
children | 5659d773cfa8 |
comparison
equal
deleted
inserted
replaced
355:0fb6c53fb135 | 356:2e3cbc1bbe3c |
---|---|
33 static u_char *ngx_http_log_header_out(ngx_http_request_t *r, u_char *buf, | 33 static u_char *ngx_http_log_header_out(ngx_http_request_t *r, u_char *buf, |
34 uintptr_t data); | 34 uintptr_t data); |
35 static u_char *ngx_http_log_unknown_header_out(ngx_http_request_t *r, u_char *buf, | 35 static u_char *ngx_http_log_unknown_header_out(ngx_http_request_t *r, u_char *buf, |
36 uintptr_t data); | 36 uintptr_t data); |
37 | 37 |
38 static int ngx_http_log_pre_conf(ngx_conf_t *cf); | 38 static ngx_int_t ngx_http_log_pre_conf(ngx_conf_t *cf); |
39 static void *ngx_http_log_create_main_conf(ngx_conf_t *cf); | 39 static void *ngx_http_log_create_main_conf(ngx_conf_t *cf); |
40 static void *ngx_http_log_create_loc_conf(ngx_conf_t *cf); | 40 static void *ngx_http_log_create_loc_conf(ngx_conf_t *cf); |
41 static char *ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, | 41 static char *ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, |
42 void *child); | 42 void *child); |
43 static char *ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, | 43 static char *ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, |
44 void *conf); | 44 void *conf); |
45 static char *ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, | 45 static char *ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, |
46 void *conf); | 46 void *conf); |
47 static int ngx_http_log_parse_format(ngx_conf_t *cf, ngx_array_t *ops, | 47 static ngx_int_t ngx_http_log_parse_format(ngx_conf_t *cf, ngx_array_t *ops, |
48 ngx_str_t *line); | 48 ngx_str_t *line); |
49 | 49 |
50 | 50 |
51 static ngx_command_t ngx_http_log_commands[] = { | 51 static ngx_command_t ngx_http_log_commands[] = { |
52 | 52 |
53 {ngx_string("log_format"), | 53 {ngx_string("log_format"), |
114 { ngx_string("o"), NGX_HTTP_LOG_ARG, ngx_http_log_header_out }, | 114 { ngx_string("o"), NGX_HTTP_LOG_ARG, ngx_http_log_header_out }, |
115 { ngx_null_string, 0, NULL } | 115 { ngx_null_string, 0, NULL } |
116 }; | 116 }; |
117 | 117 |
118 | 118 |
119 int ngx_http_log_handler(ngx_http_request_t *r) | 119 ngx_int_t ngx_http_log_handler(ngx_http_request_t *r) |
120 { | 120 { |
121 ngx_uint_t i, l; | 121 ngx_uint_t i, l; |
122 uintptr_t data; | 122 uintptr_t data; |
123 u_char *line, *p; | 123 u_char *line, *p; |
124 size_t len; | 124 size_t len; |
196 | 196 |
197 | 197 |
198 static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf, | 198 static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf, |
199 uintptr_t data) | 199 uintptr_t data) |
200 { | 200 { |
201 return buf + ngx_snprintf((char *) buf, NGX_INT32_LEN + 1, "%u", | 201 return buf + ngx_snprintf((char *) buf, NGX_INT_T_LEN + 1, |
202 "%" NGX_UINT_T_FMT, | |
202 r->connection->number); | 203 r->connection->number); |
203 } | 204 } |
204 | 205 |
205 | 206 |
206 static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, | 207 static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, |
237 | 238 |
238 | 239 |
239 static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf, | 240 static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf, |
240 uintptr_t data) | 241 uintptr_t data) |
241 { | 242 { |
242 return buf + ngx_snprintf((char *) buf, 4, "%d", | 243 return buf + ngx_snprintf((char *) buf, 4, "%" NGX_UINT_T_FMT, |
243 r->err_status ? r->err_status : r->headers_out.status); | 244 r->err_status ? r->err_status : r->headers_out.status); |
244 } | 245 } |
245 | 246 |
246 | 247 |
247 static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf, | 248 static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf, |
559 | 560 |
560 return buf + 1; | 561 return buf + 1; |
561 } | 562 } |
562 | 563 |
563 | 564 |
564 static int ngx_http_log_pre_conf(ngx_conf_t *cf) | 565 static ngx_int_t ngx_http_log_pre_conf(ngx_conf_t *cf) |
565 { | 566 { |
566 ngx_http_log_op_name_t *op; | 567 ngx_http_log_op_name_t *op; |
567 | 568 |
568 for (op = ngx_http_log_fmt_ops; op->name.len; op++) { /* void */ } | 569 for (op = ngx_http_log_fmt_ops; op->name.len; op++) { /* void */ } |
569 op->op = NULL; | 570 op->op = NULL; |