LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ELostreamOutput.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
5 
6 #include <cstring>
7 #include <fstream>
8 #include <iostream>
9 #include <string>
10 #include <typeinfo>
11 
12 using namespace std;
13 
14 namespace mf {
15  namespace service {
16 
17  ELostreamOutput::~ELostreamOutput() {}
18 
19  ELostreamOutput::ELostreamOutput(Parameters const& ps,
20  ostream& os,
21  bool const emitAtStart)
22  : ELostreamOutput{ps, cet::ostream_handle{os}, emitAtStart}
23  {}
24 
26  cet::ostream_handle&& h,
27  bool const emitAtStart)
28  : ELostreamOutput{ps(), move(h), emitAtStart}
29  {}
30 
32  cet::ostream_handle&& h,
33  bool const emitAtStart)
34  : ELdestination{config.elDestConfig()}, osh{move(h)}
35  {
36  if (emitAtStart) {
37  emitToken(osh,
38  "\n=================================================",
39  true,
40  true);
41  emitToken(osh,
42  "\nMessage Log File written by MessageLogger service\n",
43  false,
44  true);
45  emitToken(osh,
46  "\n=================================================\n",
47  true,
48  true);
49  }
50  }
51 
52  void
53  ELostreamOutput::routePayload(ostringstream const& oss, mf::ErrorObj const&)
54  {
55  osh << oss.str();
56  osh.flush();
57  }
58 
59  } // namespace service
60 } // namespace mf
void emitToken(std::ostream &os, std::string const &s, bool nl=false, bool preambleMode=false)
STL namespace.
void routePayload(std::ostringstream const &oss, mf::ErrorObj const &msg) override
fhicl::TableFragment< ELdestination::Config > elDestConfig
ELostreamOutput(Parameters const &config, cet::ostream_handle &&, bool emitAtStart=false)