mirror of
https://github.com/apache/httpd.git
synced 2025-07-30 20:03:10 +03:00
Replace DumpIOLogLevel with trace log levels
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@951902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@ -39,7 +39,6 @@ module AP_MODULE_DECLARE_DATA dumpio_module ;
|
||||
typedef struct dumpio_conf_t {
|
||||
int enable_input;
|
||||
int enable_output;
|
||||
int loglevel;
|
||||
} dumpio_conf_t;
|
||||
|
||||
/* consider up to 80 additional characters, and factor the longest
|
||||
@ -56,7 +55,7 @@ static void dumpit(ap_filter_t *f, apr_bucket *b, dumpio_conf_t *ptr)
|
||||
{
|
||||
conn_rec *c = f->c;
|
||||
|
||||
ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server,
|
||||
ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, c->base_server,
|
||||
"mod_dumpio: %s (%s-%s): %" APR_SIZE_T_FMT " bytes",
|
||||
f->frec->name,
|
||||
(APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data",
|
||||
@ -86,7 +85,7 @@ static void dumpit(ap_filter_t *f, apr_bucket *b, dumpio_conf_t *ptr)
|
||||
memcpy(xlatebuf, buf, logbytes);
|
||||
ap_xlate_proto_from_ascii(xlatebuf, logbytes);
|
||||
xlatebuf[logbytes] = '\0';
|
||||
ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server,
|
||||
ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, c->base_server,
|
||||
"mod_dumpio: %s (%s-%s): %s", f->frec->name,
|
||||
(APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data",
|
||||
b->type->name, xlatebuf);
|
||||
@ -99,14 +98,14 @@ static void dumpit(ap_filter_t *f, apr_bucket *b, dumpio_conf_t *ptr)
|
||||
* within ap_log_error, and introduce new vformatter %-escapes
|
||||
* for escaping text, and for binary text (fixed len strings).
|
||||
*/
|
||||
ap_log_error(APLOG_MARK | APLOG_NOERRNO, ptr->loglevel, 0, c->base_server,
|
||||
ap_log_error(APLOG_MARK | APLOG_NOERRNO, APLOG_TRACE7, 0, c->base_server,
|
||||
"mod_dumpio: %s (%s-%s): %.*s", f->frec->name,
|
||||
(APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data",
|
||||
b->type->name, (int)logbytes, buf);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
ap_log_error(APLOG_MARK, ptr->loglevel, rv, c->base_server,
|
||||
ap_log_error(APLOG_MARK, APLOG_TRACE7, rv, c->base_server,
|
||||
"mod_dumpio: %s (%s-%s): %s", f->frec->name,
|
||||
(APR_BUCKET_IS_METADATA(b)) ? "metadata" : "data",
|
||||
b->type->name, "error reading data");
|
||||
@ -132,7 +131,7 @@ static int dumpio_input_filter (ap_filter_t *f, apr_bucket_brigade *bb,
|
||||
conn_rec *c = f->c;
|
||||
dumpio_conf_t *ptr = f->ctx;
|
||||
|
||||
ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server,
|
||||
ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, c->base_server,
|
||||
"mod_dumpio: %s [%s-%s] %" APR_OFF_T_FMT " readbytes",
|
||||
f->frec->name,
|
||||
whichmode(mode),
|
||||
@ -146,7 +145,7 @@ static int dumpio_input_filter (ap_filter_t *f, apr_bucket_brigade *bb,
|
||||
dumpit(f, b, ptr);
|
||||
}
|
||||
} else {
|
||||
ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server,
|
||||
ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, c->base_server,
|
||||
"mod_dumpio: %s - %d", f->frec->name, ret) ;
|
||||
}
|
||||
|
||||
@ -159,7 +158,7 @@ static int dumpio_output_filter (ap_filter_t *f, apr_bucket_brigade *bb)
|
||||
conn_rec *c = f->c;
|
||||
dumpio_conf_t *ptr = f->ctx;
|
||||
|
||||
ap_log_error(APLOG_MARK, ptr->loglevel, 0, c->base_server, "mod_dumpio: %s", f->frec->name) ;
|
||||
ap_log_error(APLOG_MARK, APLOG_TRACE7, 0, c->base_server, "mod_dumpio: %s", f->frec->name) ;
|
||||
|
||||
for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b = APR_BUCKET_NEXT(b)) {
|
||||
/*
|
||||
@ -207,7 +206,6 @@ static void *dumpio_create_sconfig(apr_pool_t *p, server_rec *s)
|
||||
{
|
||||
dumpio_conf_t *ptr = apr_pcalloc(p, sizeof *ptr);
|
||||
ptr->enable_input = ptr->enable_output = 0;
|
||||
ptr->loglevel = APLOG_DEBUG;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -231,38 +229,11 @@ static const char *dumpio_enable_output(cmd_parms *cmd, void *dummy, int arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *set_loglevel(cmd_parms *cmd, void *dummy, const char *arg)
|
||||
{
|
||||
char *str;
|
||||
dumpio_conf_t *ptr =
|
||||
(dumpio_conf_t *) ap_get_module_config(cmd->server->module_config,
|
||||
&dumpio_module);
|
||||
|
||||
const char *err = ap_check_cmd_context(cmd,
|
||||
NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
|
||||
if (err != NULL) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if ((str = ap_getword_conf(cmd->pool, &arg))) {
|
||||
err = ap_parse_log_level(str, &ptr->loglevel);
|
||||
if (err != NULL)
|
||||
return apr_psprintf(cmd->pool, "DumpIOLogLevel: %s", err);
|
||||
}
|
||||
else {
|
||||
return "DumpIOLogLevel requires level keyword";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const command_rec dumpio_cmds[] = {
|
||||
AP_INIT_FLAG("DumpIOInput", dumpio_enable_input, NULL,
|
||||
RSRC_CONF, "Enable I/O Dump on Input Data"),
|
||||
AP_INIT_FLAG("DumpIOOutput", dumpio_enable_output, NULL,
|
||||
RSRC_CONF, "Enable I/O Dump on Output Data"),
|
||||
AP_INIT_TAKE1("DumpIOLogLevel", set_loglevel, NULL, RSRC_CONF,
|
||||
"Level at which DumpIO info is logged"),
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user