Implement direct data logging

This commit is contained in:
jomjol
2022-10-23 12:36:09 +02:00
parent 13f1d40ca3
commit 3743ac18f5
5 changed files with 34 additions and 11 deletions

View File

@@ -95,7 +95,7 @@ void ClassLogFile::WriteToData(std::string _ReturnRawValue, std::string _ReturnV
strftime(buffer, 80, "%Y-%m-%dT%H:%M:%S", timeinfo);
zwtime = std::string(buffer) + ":\t";
zwtime = std::string(buffer) + "\t";
fputs(zwtime.c_str(), pFile);
fputs(_ReturnRawValue.c_str(), pFile);
fputs("\t", pFile);
@@ -104,11 +104,8 @@ void ClassLogFile::WriteToData(std::string _ReturnRawValue, std::string _ReturnV
fputs(_ReturnPreValue.c_str(), pFile);
fputs("\t", pFile);
fputs(_ErrorMessageText.c_str(), pFile);
fputs("\t", pFile);
fputs(_digital.c_str(), pFile);
fputs("\t", pFile);
fputs(_analog.c_str(), pFile);
fputs("\t", pFile);
fputs("\n", pFile);
fclose(pFile);
@@ -284,6 +281,17 @@ void ClassLogFile::RemoveOld()
closedir(dir);
}
void ClassLogFile::CreateLogDirectories()
{
MakeDir("/sdcard/log");
MakeDir("/sdcard/log/data");
MakeDir("/sdcard/log/analog");
MakeDir("/sdcard/log/digit");
MakeDir("/sdcard/log/message");
MakeDir("/sdcard/log/source");
}
ClassLogFile::ClassLogFile(std::string _logroot, std::string _logfile, std::string _logdatapath, std::string _datafile)
{
logroot = _logroot;
@@ -294,6 +302,4 @@ ClassLogFile::ClassLogFile(std::string _logroot, std::string _logfile, std::stri
retentionInDays = 10;
loglevel = 0;
MakeDir("/sdcard/log/data");
MakeDir("/sdcard/test");
MakeDir("/test");
}