From 2a02a76913a91c9882868b73c72ba2e8d2be764d Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 18 May 2002 15:09:21 +0000 Subject: so here it is the code to introduce seriously debugggging classes. this is a first step only passdb stuff has beein "classized". - so what can you do? set debug level to: 1 poasdb:10 that will make all the code run at debug level 1 except the code in passdb/* files that will run at level 10 TODO: fix the man page - also smbcontrol has this nice feature so smbcontrol smbd debug 3 passdb:5 will set every smbd to have a default log level of 3 while passdb stuff will be at level 5 and so no.. minor cosmetic fix to pdbedit is there too (This used to be commit be5c3b3f5781ddc002ffcc98df04ab024dcef4ca) --- source3/include/debug.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'source3/include/debug.h') diff --git a/source3/include/debug.h b/source3/include/debug.h index 235fbf70c4..9cd7c7097d 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -38,8 +38,10 @@ */ int Debug1( char *, ... ) PRINTF_ATTRIBUTE(1,2); BOOL dbgtext( char *, ... ) PRINTF_ATTRIBUTE(1,2); +BOOL dbghdr( int level, char *file, char *func, int line ); extern XFILE *dbf; +extern pstring debugf; /* If we have these macros, we can add additional info to the header. */ #ifdef HAVE_FILE_MACRO @@ -64,7 +66,7 @@ extern XFILE *dbf; * because some references would expand incorrectly. */ #define DEBUGLEVEL *debug_level - +extern int DEBUGLEVEL; /* * Define all new debug classes here. A class is represented by an entry in @@ -77,7 +79,6 @@ extern XFILE *dbf; * at the start of the file (after #include "includes.h") will default to * using index zero, so it will behaive just like it always has. */ -#define DBGC_CLASS 0 /* override as shown above */ #define DBGC_ALL 0 /* index equivalent to DEBUGLEVEL */ #define DBGC_TDB 1 @@ -86,17 +87,18 @@ extern XFILE *dbf; #define DBGC_SMB 4 #define DBGC_RPC 5 #define DBGC_RPC_HDR 6 -#define DBGC_BDC 7 +#define DBGC_PASSDB 7 +#define DBGC_AUTH 8 +#define DBGC_BDC 9 -#define DBGC_LAST 8 /* MUST be last class value + 1 */ -extern int DEBUGLEVEL_CLASS[DBGC_LAST]; -extern BOOL DEBUGLEVEL_CLASS_ISSET[DBGC_LAST]; +/* So you can define DBGC_CLASS before including debug.h */ +#ifndef DBGC_CLASS +#define DBGC_CLASS 0 /* override as shown above */ +#endif -struct debuglevel_message { - int debuglevel_class[DBGC_LAST]; - BOOL debuglevel_class_isset[DBGC_LAST]; -}; +extern int *DEBUGLEVEL_CLASS; +extern BOOL *DEBUGLEVEL_CLASS_ISSET; /* Debugging macros * @@ -151,7 +153,7 @@ struct debuglevel_message { #define DEBUGLVL( level ) \ ( ((level) <= MAX_DEBUG_LEVEL) && \ ((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ - (!DEBUGLEVEL_CLASS[ DBGC_CLASS ] && \ + (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ && dbghdr( level, FILE_MACRO, FUNCTION_MACRO, (__LINE__) ) ) -- cgit