summaryrefslogtreecommitdiff
path: root/source3/lib/debug.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-09-12 00:47:11 +0000
committerAndrew Tridgell <tridge@samba.org>2000-09-12 00:47:11 +0000
commit06eeb3c45803bcf26ee586103a974fd852de21b9 (patch)
treef6dedcae3ebee3d75186987bb38ea315fa1ad5b9 /source3/lib/debug.c
parentd836024b2816f37abd523afb3b2d4f2bfb130f0a (diff)
downloadsamba-06eeb3c45803bcf26ee586103a974fd852de21b9.tar.gz
samba-06eeb3c45803bcf26ee586103a974fd852de21b9.tar.bz2
samba-06eeb3c45803bcf26ee586103a974fd852de21b9.zip
much nicer message interface. We now register dispatch functions,
allowing new bits of code or vfs modules to register functions without impacting on the messaging code itself. Also note that multiple registrations for the same message type are possible allowing the same message to be delivered to multiple parts of the code (possibly useful for reload messages). (This used to be commit c3350c77f52cade48d2945574e09cb630af85b92)
Diffstat (limited to 'source3/lib/debug.c')
-rw-r--r--source3/lib/debug.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index 5279dda2e3..e67aea7fd3 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -122,7 +122,7 @@ static size_t format_pos = 0;
/****************************************************************************
receive a "set debug level" message
****************************************************************************/
-void debug_message(pid_t src, void *buf, int len)
+void debug_message(enum message_type msg_type, pid_t src, void *buf, size_t len)
{
int level;
memcpy(&level, buf, sizeof(int));
@@ -143,28 +143,27 @@ void debug_message_send(pid_t pid, int level)
* get ready for syslog stuff
* ************************************************************************** **
*/
-void setup_logging( char *pname, BOOL interactive )
- {
- if( interactive )
- {
- stdout_logging = True;
- dbf = stdout;
- }
-#ifdef WITH_SYSLOG
- else
- {
- char *p = strrchr( pname,'/' );
+void setup_logging(char *pname, BOOL interactive)
+{
+ message_register(MSG_DEBUG, debug_message);
- if( p )
- pname = p + 1;
+ if (interactive) {
+ stdout_logging = True;
+ dbf = stdout;
+ }
+#ifdef WITH_SYSLOG
+ else {
+ char *p = strrchr( pname,'/' );
+ if (p)
+ pname = p + 1;
#ifdef LOG_DAEMON
- openlog( pname, LOG_PID, SYSLOG_FACILITY );
+ openlog( pname, LOG_PID, SYSLOG_FACILITY );
#else /* for old systems that have no facility codes. */
- openlog( pname, LOG_PID );
+ openlog( pname, LOG_PID );
#endif
- }
+ }
#endif
- } /* setup_logging */
+} /* setup_logging */
/* ************************************************************************** **
* reopen the log files