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