-
Notifications
You must be signed in to change notification settings - Fork 14
/
eloghandler.cc
52 lines (38 loc) · 1.31 KB
/
eloghandler.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <eloghandler.h>
#include <iostream>
#include <stdlib.h>
#include <sstream>
using namespace std;
ElogHandler::ElogHandler (const std::string h, const int p, const std::string name)
{
hostname=h;
port=p;
logbookname = name;
}
int ElogHandler::BegrunLog ( const int run, std::string who, std::string filename)
{
ostringstream command;
command << "elog -h " << hostname << " -p " << port << " -l " << logbookname <<
" -a \"Author=" << who << "\"" <<
" -a \"Subject=Run " << run << " started\" " <<
"\"Run " << run << " started with file " << filename << "\"" <<
" >/dev/null 2<&1" << endl;
// cout << command.str() << endl;
system (command.str().c_str() );
return 0;
}
int ElogHandler::EndrunLog ( const int run, std::string who, const int events, const double volume, time_t starttime)
{
ostringstream command;
command << "elog -h " << hostname << " -p " << port
<< " -l " << logbookname<< " -a \"Author=" << who << "\""
<< " -a \"Subject=Run " << run << " ended\" "
<< "\"Run " << run
<< " ended with " << events
<< " events, size is " << volume << " MB"
<< " duration " << time(0) - starttime << " s\" "
<< " >/dev/null 2<&1" << endl;
// cout << command.str() << endl;
system (command.str().c_str() );
return 0;
}