[Date Prev][Date Next] [Chronological] [Thread] [Top]

slapd logging changes

OK, here's what I have so far.  In ldap_log.h I define
the symbols for the subsystems to log for, for example:

#define LDAP_SUBSYS_GLOBAL      0

Then in debug.c, I have an array of character mnemonics
with the subsystem number they represent:

struct M2S m2s[NUM_SUBSYS] = {
	{"global", 0},
	{"operation", 1},
	{"transport", 2},
	{"connection", 3},
	{"filter", 4},
	{"backend", 5},
	{"ber", 6},
	{"config", 7},
	{"acl", 8},
	{"cache", 9},
	{"index", 10},
	{"ldif", 11}

and have a routine that returns a subsystem number for
a mnemonic.  Logging should be done using the symbol,
of course, and the mnemonics are used for setting the
levels from the configuration file or command line.  The
configuration file directive would look like:

debug           global     0
debug           operation  1

This sets the global debugging level to 0, and the operation
subsystem level to 1.

Finally, the logging in the slapd routines would look like:

	lutil_log( LDAP_SUBSYS_OPERATION, 1, "conn: %d do_search\n",

How the subsystems are broken up warrants further discussion, but
this is the basic mechanism.  Let me know what you think (but
be kind, or I'll quit and you'll have to do it yourself :-).

Gary D. Williams 
Sr. System Developer, Distributed Technologies
919-677-8000 x4059

SAS... The Power to Know