s4-debug: removed debug_ctx(). It didn't catch on :-)
[ira/wip.git] / lib / util / debug.h
index 7518a64e19613ae8fa809781dbcea20fa788f508..eb2151fc51e2912ff75626b032260ce19fbfdfc6 100644 (file)
@@ -45,17 +45,13 @@ struct debug_ops {
 #define DEBUGLEVEL *debug_level
 extern int DEBUGLEVEL;
 
-#define debug_ctx() (_debug_ctx?_debug_ctx:(_debug_ctx=talloc_new(NULL)))
-
 #define DEBUGLVL(level) ((level) <= DEBUGLEVEL)
 #define _DEBUG(level, body, header) do { \
        if (DEBUGLVL(level)) { \
-               void* _debug_ctx=NULL; \
                if (header) { \
                        dbghdr(level, __location__, __FUNCTION__); \
                } \
                dbgtext body; \
-               talloc_free(_debug_ctx); \
        } \
 } while (0)
 /** 
@@ -74,7 +70,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 +101,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