This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
XFILE *dbf = NULL;
pstring debugf = "";
-BOOL debug_warn_unknown_class = True;
-BOOL debug_auto_add_unknown_class = True;
-BOOL AllowDebugChange = True;
+bool debug_warn_unknown_class = True;
+bool debug_auto_add_unknown_class = True;
+bool AllowDebugChange = True;
/*
used to check if the user specified a
logfile on the command line
*/
-BOOL override_logfile;
+bool override_logfile;
/*
* system has been initialised.
*/
static int debug_all_class_hack = 1;
-static BOOL debug_all_class_isset_hack = True;
+static bool debug_all_class_isset_hack = True;
static int debug_num_classes = 0;
int *DEBUGLEVEL_CLASS = &debug_all_class_hack;
-BOOL *DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack;
+bool *DEBUGLEVEL_CLASS_ISSET = &debug_all_class_isset_hack;
/* DEBUGLEVEL is #defined to *debug_level */
int DEBUGLEVEL = &debug_all_class_hack;
* are unable to open a new log file for some reason.
*/
-static BOOL stdout_logging = False;
+static bool stdout_logging = False;
static int debug_count = 0;
#ifdef WITH_SYSLOG
static int syslog_level = 0;
#endif
static pstring format_bufr = { '\0' };
static size_t format_pos = 0;
-static BOOL log_overflow = False;
+static bool log_overflow = False;
/*
* Define all the debug class selection names here. Names *MUST NOT* contain
"locking", /* DBGC_LOCKING */
"msdfs", /* DBGC_MSDFS */
"dmapi", /* DBGC_DMAPI */
+ "registry", /* DBGC_REGISTRY */
NULL
};
char **list;
char *buf = NULL;
char *b;
- BOOL err = False;
+ bool err = False;
if (DEBUGLEVEL_CLASS == &debug_all_class_hack) {
return NULL;
if (new_ptr == &debug_all_class_isset_hack) {
new_ptr = NULL;
}
- new_ptr = SMB_REALLOC_ARRAY(new_ptr, BOOL, debug_num_classes + 1);
+ new_ptr = SMB_REALLOC_ARRAY(new_ptr, bool, debug_num_classes + 1);
if (!new_ptr)
return -1;
- DEBUGLEVEL_CLASS_ISSET = (int *)new_ptr;
+ DEBUGLEVEL_CLASS_ISSET = (bool *)new_ptr;
DEBUGLEVEL_CLASS_ISSET[ndx] = False;
new_ptr = SMB_REALLOC_ARRAY(classname_table, char *, debug_num_classes + 1);
printdrivers:7
****************************************************************************/
-static BOOL debug_parse_params(char **params)
+static bool debug_parse_params(char **params)
{
int i, ndx;
char *class_name;
Note: the 1st param has no "name:" preceeding it.
****************************************************************************/
-BOOL debug_parse_levels(const char *params_str)
+bool debug_parse_levels(const char *params_str)
{
char **params;
void debug_init(void)
{
- static BOOL initialised = False;
+ static bool initialised = False;
const char **p;
if (initialised)
Get ready for syslog stuff
**************************************************************************/
-void setup_logging(const char *pname, BOOL interactive)
+void setup_logging(const char *pname, bool interactive)
{
debug_init();
Fix from dgibson@linuxcare.com.
**************************************************************************/
-BOOL reopen_logs( void )
+bool reopen_logs( void )
{
pstring fname;
mode_t oldumask;
XFILE *new_dbf = NULL;
XFILE *old_dbf = NULL;
- BOOL ret = True;
+ bool ret = True;
if (stdout_logging)
return True;
Check to see if there is any need to check if the logfile has grown too big.
**************************************************************************/
-BOOL need_to_check_log_size( void )
+bool need_to_check_log_size( void )
{
int maxlog;
static void format_debug_text( const char *msg )
{
size_t i;
- BOOL timestamp = (!stdout_logging && (lp_timestamp_logs() || !(lp_loaded())));
+ bool timestamp = (!stdout_logging && (lp_timestamp_logs() || !(lp_loaded())));
for( i = 0; msg[i]; i++ ) {
/* Indent two spaces at each new line. */
Input: level - Debug level of the message (not the system-wide debug
level. )
+ cls - Debuglevel class of the calling module.
file - Pointer to a string containing the name of the file
from which this function was called, or an empty string
if the __FILE__ macro is not implemented.
****************************************************************************/
-BOOL dbghdr( int level, const char *file, const char *func, int line )
+bool dbghdr(int level, int cls, const char *file, const char *func, int line)
{
/* Ensure we don't lose any real errno value. */
int old_errno = errno;
(unsigned int)geteuid(), (unsigned int)getegid(),
(unsigned int)getuid(), (unsigned int)getgid());
}
+
+ if (lp_debug_class() && (cls != DBGC_ALL)) {
+ size_t hs_len = strlen(header_str);
+ slprintf(header_str + hs_len,
+ sizeof(header_str) -1 - hs_len,
+ ", class=%s",
+ default_classname_table[cls]);
+ }
/* Print it all out at once to prevent split syslog output. */
if( lp_debug_prefix_timestamp() ) {
- (void)Debug1( "[%s, %d%s] ",
+ (void)Debug1( "[%s, %2d%s] ",
current_timestring(lp_debug_hires_timestamp()), level,
header_str);
} else {
- (void)Debug1( "[%s, %d%s] %s:%s(%d)\n",
+ (void)Debug1( "[%s, %2d%s] %s:%s(%d)\n",
current_timestring(lp_debug_hires_timestamp()), level,
header_str, file, func, line );
}
***************************************************************************/
- BOOL dbgtext( const char *format_str, ... )
+ bool dbgtext( const char *format_str, ... )
{
va_list ap;
pstring msgbuf;