Added option to display EPOCH based debugging timestamps.
git-svn-id: http://voip.null.ro/svn/yate@1127 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
efae213892
commit
14f3a7848a
|
@ -932,7 +932,8 @@ static void usage(bool client, FILE* f)
|
|||
" w Delay creation of 1st worker thread\n"
|
||||
" o Colorize output using ANSI codes\n"
|
||||
" s Abort on bugs even during shutdown\n"
|
||||
" t Timestamp debugging messages\n"
|
||||
" t Timestamp debugging messages relative to program start\n"
|
||||
" e Timestamp debugging messages based on EPOCH (1-1-1970)\n"
|
||||
,client ? "" :
|
||||
#ifdef _WINDOWS
|
||||
" --service Run as Windows service\n"
|
||||
|
@ -975,6 +976,7 @@ int Engine::main(int argc, const char** argv, const char** env, RunMode mode, bo
|
|||
#endif
|
||||
bool client = (mode == Client);
|
||||
bool tstamp = false;
|
||||
bool abstamp = false;
|
||||
bool colorize = false;
|
||||
const char* pidfile = 0;
|
||||
const char* workdir = 0;
|
||||
|
@ -1135,6 +1137,9 @@ int Engine::main(int argc, const char** argv, const char** env, RunMode mode, bo
|
|||
case 'o':
|
||||
colorize = true;
|
||||
break;
|
||||
case 'e':
|
||||
abstamp = true;
|
||||
// fall through
|
||||
case 't':
|
||||
tstamp = true;
|
||||
break;
|
||||
|
@ -1311,7 +1316,7 @@ int Engine::main(int argc, const char** argv, const char** env, RunMode mode, bo
|
|||
#endif
|
||||
|
||||
if (tstamp)
|
||||
setDebugTimestamp();
|
||||
setDebugTimestamp(abstamp);
|
||||
|
||||
#ifdef _WINDOWS
|
||||
if (service)
|
||||
|
|
|
@ -56,7 +56,7 @@ static int s_debug = DebugWarn;
|
|||
static int s_indent = 0;
|
||||
static bool s_debugging = true;
|
||||
static bool s_abort = false;
|
||||
static u_int64_t s_timestamp = 0;
|
||||
static int64_t s_timestamp = -1;
|
||||
static u_int64_t s_startTime = 0;
|
||||
|
||||
static const char* const s_colors[11] = {
|
||||
|
@ -142,7 +142,7 @@ static void dbg_output(int level,const char* prefix, const char* format, va_list
|
|||
return;
|
||||
char buf[OUT_BUFFER_SIZE];
|
||||
unsigned int n = 0;
|
||||
if (s_timestamp) {
|
||||
if (s_timestamp >= 0) {
|
||||
u_int64_t t = Time::now() - s_timestamp;
|
||||
unsigned int s = (unsigned int)(t / 1000000);
|
||||
unsigned int u = (unsigned int)(t % 1000000);
|
||||
|
@ -290,9 +290,9 @@ const char* debugColor(int level)
|
|||
return s_colors[level];
|
||||
}
|
||||
|
||||
void setDebugTimestamp()
|
||||
void setDebugTimestamp(bool absolute)
|
||||
{
|
||||
s_timestamp = (Time::now() / 1000000) * 1000000;
|
||||
s_timestamp = absolute ? 0 : (Time::now() / 1000000) * 1000000;
|
||||
}
|
||||
|
||||
int DebugEnabler::debugLevel(int level)
|
||||
|
|
3
yate.8
3
yate.8
|
@ -103,6 +103,9 @@ Abort if bugs are encountered even during shutdown
|
|||
.TP
|
||||
.B \-Dt
|
||||
Add start time relative timestamps to debugging messages
|
||||
.TP
|
||||
.B \-De
|
||||
Add EPOCH (1-1-1970) based timestamps to debugging messages
|
||||
.SH COMMANDS
|
||||
Each command is sent to the YATE modules immediately after initialization.
|
||||
Modules define command syntax so that is not described here. Please look at
|
||||
|
|
|
@ -207,8 +207,9 @@ YATE_API bool abortOnBug(bool doAbort);
|
|||
|
||||
/**
|
||||
* Enable timestamping of output messages and set the time start reference
|
||||
* @param absolute Timestamps are absolute from EPOCH, not from program start
|
||||
*/
|
||||
YATE_API void setDebugTimestamp();
|
||||
YATE_API void setDebugTimestamp(bool absolute = false);
|
||||
|
||||
/**
|
||||
* Standard debugging levels.
|
||||
|
|
Loading…
Reference in New Issue