The audit trail generator sample is included in the distribution package and is located in the samples
directory. This tool can be used to generate the CME audit trail files.
It has the following arguments:
LogFileToAnalyse
- The path to the *.summary
log file that will be used as a source file for audit trail data.
OutputFieldDelimiter
- The delimiter between fields in the resulting audit file (by default, the comma is used).
CMETradeDayStartTimeUtc
- The CME trade day start time in UTC (by default, 4:45 CST - 9:45 UTC is used).
Example:
$ AuditTrailGenerator SESSION_NAME.summary
- Note
- The format of the
*.summary
log file and audit trail requirements for CME iLink 3 differs from the iLink 2. Therefore, there are two different audit trail generators. This means that the audit trail generator for iLink 2 cannot be used to generate audit trail files for iLink 3.
Source code
namespace
{
std::vector<std::string> split(const std::string & str, char sep)
{
std::vector<std::string> elems;
std::stringstream ss(str);
std::string item;
while (std::getline(ss, item, sep))
{
elems.push_back(item);
}
return elems;
}
}
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cerr
<< "\nCME Audit Trail Spreadsheet Generator."
"\n\tUsage: [SummaryFileName|DirectoryName] (OutputFieldDelimiter) (CMETradeDayStartTimeUtc)\n\t"
"where CMEStartTradeDayTimeUtc - CME trade day start time in UTC " << std::endl;
return 1;
}
try
{
unsigned int hour = 9;
unsigned int minute = 45;
if (argc == 4)
{
std::string sTime(argv[3]);
std::vector<std::string> parts = split(sTime, ':');
hour = std::atoi(parts.at(0).c_str());
minute = std::atoi(parts.at(1).c_str());
}
generator.generate();
}
catch (const std::exception& ex)
{
std::cerr << "EXCEPTION: " << ex.what() << std::endl;
return 1;
}
catch (...)
{
std::cerr << "Unknown error." << std::endl;
return 1;
}
std::clog << "Done." << std::endl;
return 0;
}