Add pid value to debug messages.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/158/head
Michele Calgaro 3 years ago
parent 5f795c0bb2
commit 0970152d07
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -295,18 +295,20 @@ static void kDebugBackend( unsigned short nLevel, unsigned int nArea, const char
return;
}
const int BUFSIZE = 4096;
char buf[BUFSIZE];
if ( !kDebug_data->aAreaName.isEmpty() ) {
strlcpy( buf, TQDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] [").ascii(), BUFSIZE );
strlcat( buf, kDebug_data->aAreaName.data(), BUFSIZE );
strlcat( buf, "] ", BUFSIZE );
strlcat( buf, data, BUFSIZE );
}
else {
strlcpy( buf, TQDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").ascii(), BUFSIZE );
strlcat( buf, data, BUFSIZE );
const int BUF_SIZE = 4096;
const int BUF_PID_SIZE = 20;
char buf[BUF_SIZE];
char buf_pid[BUF_PID_SIZE];
strlcpy(buf, TQDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").ascii(), BUF_SIZE);
if (!kDebug_data->aAreaName.isEmpty())
{
strlcat( buf, "[", BUF_SIZE );
strlcat( buf, kDebug_data->aAreaName.data(), BUF_SIZE );
strlcat( buf, "] ", BUF_SIZE );
}
snprintf(buf_pid, BUF_PID_SIZE, "[%d] ", getpid());
strlcat(buf, buf_pid, BUF_SIZE);
strlcat(buf, data, BUF_SIZE);
// Output
switch( nOutput )

Loading…
Cancel
Save