1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-12 01:49:28 +03:00

Fix ndrdump to use a common setup_logging() API

By adding a new common setup_logging_stdout() API, we no longer need to abuse the ABI compatability between the different setup_logging() calls in Samba3 and Samba4's DEBUG() subsystems.

The revert of 49a6d757b4 works with this
to fix bug 6211.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett
2009-06-29 20:12:23 +10:00
parent 0e95b807b9
commit 6e92505080
5 changed files with 29 additions and 2 deletions

View File

@ -197,6 +197,14 @@ _PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtyp
reopen_logs();
}
/**
Just run logging to stdout for this program
*/
_PUBLIC_ void setup_logging_stdout(void)
{
setup_logging(NULL, DEBUG_STDOUT);
}
/**
return a string constant containing n tabs
no more than 10 tabs are returned

View File

@ -74,7 +74,11 @@ extern int DEBUGLEVEL;
*/
#define DEBUGTAB(n) do_debug_tab(n)
/** Possible destinations for the debug log */
/** Possible destinations for the debug log (in order of precedence -
* once set to DEBUG_FILE, it is not possible to reset to DEBUG_STDOUT
* for example. This makes it easy to override for debug to stderr on
* the command line, as the smb.conf cannot reset it back to
* file-based logging */
enum debug_logtype {DEBUG_STDOUT = 0, DEBUG_FILE = 1, DEBUG_STDERR = 2};
/**
@ -101,6 +105,11 @@ _PUBLIC_ void debug_schedule_reopen_logs(void);
*/
_PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtype);
/**
Just run logging to stdout for this program
*/
_PUBLIC_ void setup_logging_stdout(void);
/**
return a string constant containing n tabs
no more than 10 tabs are returned

View File

@ -179,7 +179,7 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
dbf = x_stderr;
setup_logging(argv[0], true);
setup_logging_stdout();
pc = poptGetContext("ndrdump", argc, argv, long_options, 0);

View File

@ -466,6 +466,7 @@ void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32
void debug_init(void);
void debug_register_msgs(struct messaging_context *msg_ctx);
void setup_logging(const char *pname, bool interactive);
void setup_logging_stdout( void );
void debug_set_logfile(const char *name);
bool reopen_logs( void );
void force_check_log_size( void );

View File

@ -605,6 +605,15 @@ void setup_logging(const char *pname, bool interactive)
#endif
}
/**
Just run logging to stdout for this program
*/
_PUBLIC_ void setup_logging_stdout(void)
{
setup_logging(NULL, True);
}
/***************************************************************************
Set the logfile name.
**************************************************************************/