[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Cluster-devel] logsys in cluster3

On Tue, Jul 01, 2008 at 07:01:42AM +0200, Fabio M. Di Nitto wrote:
> No. You can just install the callback and be done with it. The ccs fd was 
> never a real fd to poll.

OK, it's a cman callback.  If the ccs "connection" isn't really a
connection and if it's not necessary then can we get rid of the illusion?

> Given that this code is going to be re-implemented N times, I suggest 
> again to create a cluster/common/helpers with pre-built objects to just 
> include at linking time (note that we also share and duplicate a lot of 
> header files around and it was in my mind for sometime to create a 
> cluster/common/includes too)

Let's get the code in place and replicated first, before trying to factor
it.  And I don't think it needs to be too complicated.  Assuming I can
make my simplified logsys api work (really, we're trying to solve stuff in
parallel here that should be sequential)...

/* Read cluster.conf settings and convert them into logsys values.
   If no cluster.conf setting exists, the default that was used in
   logsys_init() is used. */

int read_ccs_logging(int *mode, int *facility, int *priority, char *file,
		     int *debug)
	strcpy(file, MYPROG_DEFAULT_FILE);

	/* Read settings from ccs to override the defaults above.
	   (with some appropriate helper functions around ccs_get, the
	   following can be pretty compact)

	   mode from

	   facility from

	   priority from
	   "/cluster/logging/logger_subsys[ subsys=\"prog_name\"]/@syslog_level"

	   file from

	   debug from
	   "/cluster/logging/logger_subsys[ subsys=\"prog_name\"]/@debug"

/* this function will also be called when we get a cman config-update event */

void setup_logging(int *prog_debug)
	int mode, facility, priority;
	char *file;

	/* The debug setting is special, it's used by the program
	   and not used to configure logsys. */

	read_ccs_logging(&mode, &facility, &priority, file, prog_debug);
	logsys_conf(mode, facility, priority, file);

int main(int argc, char **argv)

	/* set up cman/ccs connections ... */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]