mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 16:39:57 +00:00
Darren Hagues logging code causes issues since the state of the logger is not reset on close.
33 lines
668 B
C++
33 lines
668 B
C++
#include "ANTLogger.h"
|
|
|
|
ANTLogger::ANTLogger(QObject *parent) : QObject(parent)
|
|
{
|
|
isLogging=false;
|
|
}
|
|
|
|
void ANTLogger::logRawAntMessage(const ANTMessage *message, const struct timeval *timestamp)
|
|
{
|
|
if (message==NULL && timestamp==NULL) {
|
|
if (isLogging) {
|
|
// close debug file
|
|
antlog.close();
|
|
isLogging=false;
|
|
}
|
|
return;
|
|
}
|
|
|
|
if (!isLogging) {
|
|
antlog.setFileName("antlog.bin");
|
|
antlog.open(QIODevice::WriteOnly | QIODevice::Truncate);
|
|
isLogging = true;
|
|
}
|
|
|
|
QDataStream out(&antlog);
|
|
|
|
for (int i=0; i<ANT_MAX_MESSAGE_SIZE; i++)
|
|
out<<message->data[i];
|
|
|
|
|
|
}
|
|
|