File indexing completed on 2025-08-02 08:21:01
0001 #include <eloghandler.h>
0002 #include <iostream>
0003 #include <stdlib.h>
0004 #include <sstream>
0005
0006 using namespace std;
0007
0008 ElogHandler::ElogHandler (const std::string h, const int p, const std::string name)
0009 {
0010 hostname=h;
0011 port=p;
0012 logbookname = name;
0013 }
0014
0015 int ElogHandler::BegrunLog ( const int run, std::string who, std::string filename)
0016 {
0017
0018 ostringstream command;
0019
0020 command << "elog -h " << hostname << " -p " << port << " -l " << logbookname <<
0021 " -a \"Author=" << who << "\"" <<
0022 " -a \"Subject=Run " << run << " started\" " <<
0023 "\"Run " << run << " started with file " << filename << "\"" <<
0024 " >/dev/null 2<&1" << endl;
0025
0026
0027
0028 system (command.str().c_str() );
0029 return 0;
0030 }
0031
0032 int ElogHandler::EndrunLog ( const int run, std::string who, const int events, const double volume, time_t starttime)
0033 {
0034
0035
0036 ostringstream command;
0037
0038 command << "elog -h " << hostname << " -p " << port
0039 << " -l " << logbookname<< " -a \"Author=" << who << "\""
0040 << " -a \"Subject=Run " << run << " ended\" "
0041 << "\"Run " << run
0042 << " ended with " << events
0043 << " events, size is " << volume << " MB"
0044 << " duration " << time(0) - starttime << " s\" "
0045 << " >/dev/null 2<&1" << endl;
0046
0047
0048 system (command.str().c_str() );
0049
0050
0051 return 0;
0052 }