mirror of
https://github.com/samba-team/samba.git
synced 2025-11-28 12:23:49 +03:00
r21825: add debug prefix timestamp to allow "short timestamps" to be
added to debug messages
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
f94e5af72e
commit
4af2795e65
@@ -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
|
/* Print the header if timestamps are turned on. If parameters are
|
||||||
* not yet loaded, then default to timestamps on.
|
* 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];
|
char header_str[200];
|
||||||
|
|
||||||
header_str[0] = '\0';
|
header_str[0] = '\0';
|
||||||
@@ -980,10 +980,16 @@ BOOL dbghdr( int level, const char *file, const char *func, int line )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Print it all out at once to prevent split syslog output. */
|
/* Print it all out at once to prevent split syslog output. */
|
||||||
|
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",
|
(void)Debug1( "[%s, %d%s] %s:%s(%d)\n",
|
||||||
current_timestring(lp_debug_hires_timestamp()), level,
|
current_timestring(lp_debug_hires_timestamp()), level,
|
||||||
header_str, file, func, line );
|
header_str, file, func, line );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
errno = old_errno;
|
errno = old_errno;
|
||||||
return( True );
|
return( True );
|
||||||
|
|||||||
@@ -290,6 +290,7 @@ typedef struct {
|
|||||||
BOOL bClientNTLMv2Auth;
|
BOOL bClientNTLMv2Auth;
|
||||||
BOOL bClientPlaintextAuth;
|
BOOL bClientPlaintextAuth;
|
||||||
BOOL bClientUseSpnego;
|
BOOL bClientUseSpnego;
|
||||||
|
BOOL bDebugPrefixTimestamp;
|
||||||
BOOL bDebugHiresTimestamp;
|
BOOL bDebugHiresTimestamp;
|
||||||
BOOL bDebugPid;
|
BOOL bDebugPid;
|
||||||
BOOL bDebugUid;
|
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},
|
{"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},
|
{"debug timestamp", P_BOOL, P_GLOBAL, &Globals.bTimestampLogs, NULL, NULL, FLAG_ADVANCED},
|
||||||
{"timestamp logs", 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 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 pid", P_BOOL, P_GLOBAL, &Globals.bDebugPid, NULL, NULL, FLAG_ADVANCED},
|
||||||
{"debug uid", P_BOOL, P_GLOBAL, &Globals.bDebugUid, 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.bSyslogOnly = False;
|
||||||
Globals.bTimestampLogs = True;
|
Globals.bTimestampLogs = True;
|
||||||
string_set(&Globals.szLogLevel, "0");
|
string_set(&Globals.szLogLevel, "0");
|
||||||
|
Globals.bDebugPrefixTimestamp = False;
|
||||||
Globals.bDebugHiresTimestamp = False;
|
Globals.bDebugHiresTimestamp = False;
|
||||||
Globals.bDebugPid = False;
|
Globals.bDebugPid = False;
|
||||||
Globals.bDebugUid = 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_INTEGER(lp_server_schannel, &Globals.serverSchannel)
|
||||||
FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
|
FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
|
||||||
FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
|
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_hires_timestamp, &Globals.bDebugHiresTimestamp)
|
||||||
FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
|
FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
|
||||||
FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
|
FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
|
||||||
|
|||||||
Reference in New Issue
Block a user