summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorHerb Lewis <herb@samba.org>2007-03-13 17:39:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:18:37 -0500
commit4af2795e65f6bab156b300d720c7ea75c944bb87 (patch)
treec4cc08b37a0afd816d5e51e10be6962758313c66 /source
parentf94e5af72e282f70ca5454cdf3aed510b747eb93 (diff)
downloadsamba-4af2795e65f6bab156b300d720c7ea75c944bb87.tar.gz
samba-4af2795e65f6bab156b300d720c7ea75c944bb87.tar.xz
samba-4af2795e65f6bab156b300d720c7ea75c944bb87.zip
r21825: add debug prefix timestamp to allow "short timestamps" to be
added to debug messages
Diffstat (limited to 'source')
-rw-r--r--source/lib/debug.c10
-rw-r--r--source/param/loadparm.c4
2 files changed, 12 insertions, 2 deletions
diff --git a/source/lib/debug.c b/source/lib/debug.c
index 5f141661106..62fda5741c9 100644
--- a/source/lib/debug.c
+++ b/source/lib/debug.c
@@ -962,7 +962,7 @@ BOOL dbghdr( int level, const char *file, const char *func, int line )
/* Print the header if timestamps are turned on. If parameters are
* not yet loaded, then default to timestamps on.
*/
- if( lp_timestamp_logs() || !(lp_loaded()) ) {
+ if( lp_timestamp_logs() || lp_debug_prefix_timestamp() || !(lp_loaded()) ) {
char header_str[200];
header_str[0] = '\0';
@@ -980,9 +980,15 @@ BOOL dbghdr( int level, const char *file, const char *func, int line )
}
/* Print it all out at once to prevent split syslog output. */
- (void)Debug1( "[%s, %d%s] %s:%s(%d)\n",
+ if( lp_debug_prefix_timestamp() ) {
+ (void)Debug1( "[%s, %d%s] ",
+ current_timestring(lp_debug_hires_timestamp()), level,
+ header_str);
+ } else {
+ (void)Debug1( "[%s, %d%s] %s:%s(%d)\n",
current_timestring(lp_debug_hires_timestamp()), level,
header_str, file, func, line );
+ }
}
errno = old_errno;
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index b90b53c16bb..b9e9505b346 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -290,6 +290,7 @@ typedef struct {
BOOL bClientNTLMv2Auth;
BOOL bClientPlaintextAuth;
BOOL bClientUseSpnego;
+ BOOL bDebugPrefixTimestamp;
BOOL bDebugHiresTimestamp;
BOOL bDebugPid;
BOOL bDebugUid;
@@ -952,6 +953,7 @@ static struct parm_struct parm_table[] = {
{"max log size", P_INTEGER, P_GLOBAL, &Globals.max_log_size, NULL, NULL, FLAG_ADVANCED},
{"debug timestamp", P_BOOL, P_GLOBAL, &Globals.bTimestampLogs, NULL, NULL, FLAG_ADVANCED},
{"timestamp logs", P_BOOL, P_GLOBAL, &Globals.bTimestampLogs, NULL, NULL, FLAG_ADVANCED},
+ {"debug prefix timestamp", P_BOOL, P_GLOBAL, &Globals.bDebugPrefixTimestamp, NULL, NULL, FLAG_ADVANCED},
{"debug hires timestamp", P_BOOL, P_GLOBAL, &Globals.bDebugHiresTimestamp, NULL, NULL, FLAG_ADVANCED},
{"debug pid", P_BOOL, P_GLOBAL, &Globals.bDebugPid, NULL, NULL, FLAG_ADVANCED},
{"debug uid", P_BOOL, P_GLOBAL, &Globals.bDebugUid, NULL, NULL, FLAG_ADVANCED},
@@ -1516,6 +1518,7 @@ static void init_globals(BOOL first_time_only)
Globals.bSyslogOnly = False;
Globals.bTimestampLogs = True;
string_set(&Globals.szLogLevel, "0");
+ Globals.bDebugPrefixTimestamp = False;
Globals.bDebugHiresTimestamp = False;
Globals.bDebugPid = False;
Globals.bDebugUid = False;
@@ -1947,6 +1950,7 @@ FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
+FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)