Merge pull request #126 from mirabilos/logging-time-format
Use a sortable and more standard datetime logging format
This commit is contained in:
commit
10d2a9ca84
2 changed files with 11 additions and 21 deletions
|
@ -11,7 +11,7 @@ override_dh_usrlocal:
|
||||||
install -D -m 0755 jamulus $$(pwd)/debian/jamulus/usr/bin/
|
install -D -m 0755 jamulus $$(pwd)/debian/jamulus/usr/bin/
|
||||||
mkdir -p $$(pwd)/debian/jamulus/usr/share/applications/
|
mkdir -p $$(pwd)/debian/jamulus/usr/share/applications/
|
||||||
install -D -m 0755 $$(pwd)/distributions/jamulus.desktop $$(pwd)/debian/jamulus/usr/share/applications/
|
install -D -m 0755 $$(pwd)/distributions/jamulus.desktop $$(pwd)/debian/jamulus/usr/share/applications/
|
||||||
mkdir -p $$(pwd)/debian/jamulus/usr/share/icons/hicolor/48x48/apps/
|
mkdir -p $$(pwd)/debian/jamulus/usr/share/icons/hicolor/512x512/apps/
|
||||||
cp $$(pwd)/distributions/jamulus.png $$(pwd)/debian/jamulus/usr/share/icons/hicolor/512x512/apps/
|
cp $$(pwd)/distributions/jamulus.png $$(pwd)/debian/jamulus/usr/share/icons/hicolor/512x512/apps/
|
||||||
mkdir -p $$(pwd)/debian/jamulus/lib/systemd/system
|
mkdir -p $$(pwd)/debian/jamulus/lib/systemd/system
|
||||||
cp $$(pwd)/distributions/jamulus-server.service $$(pwd)/debian/jamulus/lib/systemd/system/
|
cp $$(pwd)/distributions/jamulus-server.service $$(pwd)/debian/jamulus/lib/systemd/system/
|
||||||
|
|
|
@ -118,24 +118,17 @@ void CServerLogging::ParseLogFile ( const QString& strFileName )
|
||||||
QStringList strlistCurLine = strCurLine.split ( "," );
|
QStringList strlistCurLine = strCurLine.split ( "," );
|
||||||
|
|
||||||
// check number of separated strings condition
|
// check number of separated strings condition
|
||||||
if ( strlistCurLine.size() == 4 )
|
if ( strlistCurLine.size() == 3 )
|
||||||
{
|
{
|
||||||
// first entry
|
// first entry
|
||||||
QDate curDate =
|
QDateTime curDateTime =
|
||||||
QDate::fromString ( strlistCurLine.at ( 0 ).trimmed(),
|
QDateTime::fromString ( strlistCurLine.at ( 0 ).trimmed(),
|
||||||
"d.M.yyyy" );
|
"yyyy-MM-dd HH:mm:ss" );
|
||||||
|
|
||||||
// second entry
|
if ( curDateTime.isValid() )
|
||||||
QTime curTime =
|
|
||||||
QTime::fromString ( strlistCurLine.at ( 1 ).trimmed(),
|
|
||||||
"hh:mm:ss" );
|
|
||||||
|
|
||||||
if ( curDate.isValid() && curTime.isValid() )
|
|
||||||
{
|
{
|
||||||
QDateTime curDateTime ( curDate, curTime );
|
|
||||||
|
|
||||||
// check if server stop or new client connection
|
// check if server stop or new client connection
|
||||||
QString strAddress = strlistCurLine.at ( 2 ).trimmed();
|
QString strAddress = strlistCurLine.at ( 1 ).trimmed();
|
||||||
|
|
||||||
if ( strAddress.isEmpty() )
|
if ( strAddress.isEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -147,8 +140,8 @@ void CServerLogging::ParseLogFile ( const QString& strFileName )
|
||||||
{
|
{
|
||||||
QHostAddress curAddress;
|
QHostAddress curAddress;
|
||||||
|
|
||||||
// third entry is IP address
|
// second entry is IP address
|
||||||
if ( curAddress.setAddress ( strlistCurLine.at ( 2 ).trimmed() ) )
|
if ( curAddress.setAddress ( strlistCurLine.at ( 1 ).trimmed() ) )
|
||||||
{
|
{
|
||||||
// new client connection
|
// new client connection
|
||||||
JpegHistoryGraph.Add ( curDateTime, curAddress );
|
JpegHistoryGraph.Add ( curDateTime, curAddress );
|
||||||
|
@ -168,9 +161,6 @@ QString CServerLogging::CurTimeDatetoLogString()
|
||||||
// time and date to string conversion
|
// time and date to string conversion
|
||||||
const QDateTime curDateTime = QDateTime::currentDateTime();
|
const QDateTime curDateTime = QDateTime::currentDateTime();
|
||||||
|
|
||||||
// format date and time output according to "3.9.2006, 11:38:08"
|
// format date and time output according to "2006-09-30 11:38:08"
|
||||||
return QString().setNum ( curDateTime.date().day() ) + "." +
|
return curDateTime.toString("yyyy-MM-dd HH:mm:ss");
|
||||||
QString().setNum ( curDateTime.date().month() ) + "." +
|
|
||||||
QString().setNum ( curDateTime.date().year() ) + ", " +
|
|
||||||
curDateTime.time().toString();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue