httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ondrej Sury <ond...@sury.org>
Subject Re: Pluggable mod_log_config
Date Mon, 03 Oct 2005 14:53:15 GMT
On Mon, 2005-10-03 at 10:26 -0400, Brian Akins wrote:
> Ondrej Sury wrote:
> 
> > 
> > Nope, (void *)cls->log_writer is pointer to log file descriptor.
> 
> this can be anything. (it's a void).  In some modules I have written, 
> it's a wrapper around a socket. See, open_config_log
> 
> cls->log_writer = log_writer_init(p, s, cls->fname);
> 
> log_writer_init retures whatever you function returns.  In 
> mod_log_config, it's an apr_file_t *.

Sorry for not being accurate.  My point was that cls->log_writer hold
logger *data/configuration* and not logging *function*.

> >>Also, init is called for each CustomLog config entry.
> > 
> > 
> > Yep, but only ap_log_writer_init is called.  You need to do something
> > like that:
> > 
> > foreach provider in ap_log_writer_providers {
> > 	cls->log_writer = provider->init(...., &cls->log_data);
> > 
> > 	if (cls->log_writer) {
> > 		break;
> > 	}
> > }
> > 
> > Then later when writing log you need to call
> > 
> > cls->log_writer(..., cls->log_data, ...)
> > 
> > instead of just
> > 
> > log_writer(...)
> 
> yes. basically.
> 
> I figure you could change cls to:
> 
> typedef struct {
>      const char *fname;
>      const char *format_string;
>      apr_array_header_t *format;
>      void *log_writer;
>      void *log_init; /*added*/
>      char *condition_var;
> } config_log_state;

What about:

typedef struct {
	const char *fname;
	const char *format_string;
	apr_array_header_t *format;
	ap_log_writer *log_writer; /* changed */
	ap_log_writer_init *log_writer_init; /* added */
	void *log_writer_config; /* changed from log_writer */
	char *condition_var;
} config_log_state;

If you set log writing function to log_writer then you are missing
config for this writer (ie. socket or apr_file_t * or mysql connection
or whatever else).

> and log_init and log_writer would be set at config time.  log_init would 
> get ran in open_logs.

Agree.

Ondrej.
-- 
Ondrej Sury <ondrej@sury.org>

Mime
View raw message