better logging capabilities

This commit is contained in:
Volker Fischer 2006-09-03 09:49:15 +00:00
parent b31360a27a
commit 0c3c3fa8ae
3 changed files with 27 additions and 9 deletions

View file

@ -298,7 +298,7 @@ void CChannel::SetNetwBufSizeFactOut ( const int iNewNetwBlSiFactOut )
void CChannel::OnNetwBlSiFactChange ( int iNewNetwBlSiFact ) void CChannel::OnNetwBlSiFactChange ( int iNewNetwBlSiFact )
{ {
// TEST // TEST
qDebug ( "new network block size factor: %d", iNewNetwBlSiFact ); //qDebug ( "new network block size factor: %d", iNewNetwBlSiFact );
SetNetwBufSizeFactOut ( iNewNetwBlSiFact ); SetNetwBufSizeFactOut ( iNewNetwBlSiFact );
} }
@ -340,7 +340,7 @@ void CChannel::SetSockBufSize ( const int iNumBlocks )
void CChannel::OnJittBufSizeChange ( int iNewJitBufSize ) void CChannel::OnJittBufSizeChange ( int iNewJitBufSize )
{ {
// TEST // TEST
qDebug ( "new jitter buffer size: %d", iNewJitBufSize ); //qDebug ( "new jitter buffer size: %d", iNewJitBufSize );
SetSockBufSize ( iNewJitBufSize ); SetSockBufSize ( iNewJitBufSize );
} }
@ -447,10 +447,10 @@ for ( int i = 0; i < iCurNetwInBlSiFact * MIN_BLOCK_SIZE_SAMPLES; i++ ) {
// inform other objects that new connection was established // inform other objects that new connection was established
if ( bNewConnection ) if ( bNewConnection )
{ {
// log new connection
// TEST debug output CHostAddress address ( GetAddress() );
CHostAddress address ( GetAddress() ); qDebug ( CLogTimeDate::toString() + "Connected with IP %s",
qDebug ( "new connection with IP %s", address.InetAddr.toString().latin1() ); address.InetAddr.toString().latin1() );
emit NewConnection(); emit NewConnection();
} }

View file

@ -27,7 +27,7 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CServer::CServer () : Socket ( &ChannelSet, this ) CServer::CServer () : Socket ( &ChannelSet, this )
{ {
vecsSendData.Init ( MIN_BLOCK_SIZE_SAMPLES ); vecsSendData.Init ( MIN_BLOCK_SIZE_SAMPLES );
/* init moving average buffer for response time evaluation */ /* init moving average buffer for response time evaluation */
@ -73,7 +73,7 @@ void CServer::Start ()
/* init time for response time evaluation */ /* init time for response time evaluation */
TimeLastBlock = QTime::currentTime (); TimeLastBlock = QTime::currentTime ();
qDebug("Server started"); qDebug ( CLogTimeDate::toString() + "Server started" );
} }
} }
@ -82,7 +82,7 @@ void CServer::Stop ()
/* stop main timer */ /* stop main timer */
Timer.stop (); Timer.stop ();
qDebug("Server stopped"); qDebug ( CLogTimeDate::toString() + "Server stopped" );
} }
void CServer::OnTimer () void CServer::OnTimer ()

View file

@ -436,6 +436,24 @@ public:
); );
} }
}; };
/* Time and Data to String conversion --------------------------------------- */
class CLogTimeDate
{
public:
static QString toString()
{
const QDateTime curDateTime = QDateTime::currentDateTime();
// format date and time output according to "3.9.2006 11:38:08: "
return QString().setNum ( curDateTime.date().day() ) + "." +
QString().setNum ( curDateTime.date().month() ) + "." +
QString().setNum ( curDateTime.date().year() ) + " " +
curDateTime.time().toString() + ": ";
}
};
#endif /* !defined(UTIL_HOIH934256GEKJH98_3_43445KJIUHF1912__INCLUDED_) */ #endif /* !defined(UTIL_HOIH934256GEKJH98_3_43445KJIUHF1912__INCLUDED_) */