File MIES_MiesUtilities_Logging.ipf

This file holds MIES utility functions for logging.

Functions

string GetZeroMQXOPLogfile()

Return the disc location of the (possibly non-existing) ZeroMQ-XOP logfile.

string GetITCXOP2Logfile()

Return the disc location of the (possibly non-existing) ITCXOP2 logfile.

std::tuple<WaveText, variable> FilterByDate(WaveText entries, variable first, variable last)

Filters log file entries by data, returns a null wave if no entries were found.

static variable FindFirstLogEntryElementByDate(WaveText entries, variable timeStamp)

Find the index of the first log file line that is from a time greater or equal than timeStamp The algorithm is a binary search that requires ascending order of time stamps of the log file entries. entries is a text wave where each line contains a log file entry as JSON. This JSON can contain a timestamp but can also contain no or an invalid timestamp. If the binary search hits an invalid timestamp the current search index is moved by a linear search to lower indices until a valid timestamp or the lower boundary is reached.

Parameters:
  • entries – text wave where each line contains a log file entry as serialized JSON with ascending order of time stamps

  • timeStamp – time stamp that is searched

Returns:

index + 1 of the last entry with a time stamp lower than timeStamp

static variable FindLastLogEntryElementByDate(WaveText entries, variable timeStamp)

Find the index of the last log file line that is from a time smaller or equal than timeStamp The algorithm is a binary search that requires ascending order of time stamps of the log file entries. entries is a text wave where each line contains a log file entry as JSON. This JSON can contain a timestamp but can also contain no or an invalid timestamp. If the binary search hits an invalid timestamp the current search index is moved by a linear search to higher indices until a valid timestamp or the higher boundary is reached.

Parameters:
  • entries – text wave where each line contains a log file entry as serialized JSON with ascending order of time stamps

  • timeStamp – time stamp that is searched

Returns:

index - 1 of the first entry with a time stamp greater than timeStamp

variable ArchiveLogFilesOnceAndKeepMonth()
static string GetDateOfLogEntry(string entry)
static variable ArchiveLogFile(WaveText logData, string fullFilePath, variable index)
static variable SaveRemainingLog(WaveText logData, variable index, string fullFilePath)
static string LastArchivedLogFile(string fullFilePath)

Variables

static const double ARCHIVE_SIZETHRESHOLD = 52428800
static const string ARCHIVEDLOG_SUFFIX = "_old_"