Classes | Public Types | Public Member Functions | Private Member Functions | List of all members
mfplugins::ELsyslog Class Reference
Inheritance diagram for mfplugins::ELsyslog:
mf::service::ELdestination

Classes

struct  Config
 

Public Types

using Parameters = fhicl::WrappedTable< Config >
 
- Public Types inherited from mf::service::ELdestination
enum  flag_enum {
  NO_LINE_BREAKS, TIMESTAMP, MILLISECOND, MODULE,
  SUBROUTINE, TEXT, SOME_CONTEXT, SERIAL,
  FULL_CONTEXT, TIME_SEPARATE, EPILOGUE_SEPARATE, NFLAGS
}
 

Public Member Functions

 ELsyslog (Parameters const &pset)
 
- Public Member Functions inherited from mf::service::ELdestination
virtual ~ELdestination () noexcept=default
 
 ELdestination (Config const &)
 
 ELdestination (ELdestination const &)=delete
 
 ELdestination (ELdestination &&)=delete
 
ELdestinationoperator= (ELdestination const &)=delete
 
ELdestinationoperator= (ELdestination &&)=delete
 
void setThreshold (ELseverityLevel sv)
 
virtual void log (mf::ErrorObj &)
 
virtual void finish ()
 
virtual void summary ()
 

Private Member Functions

void fillPrefix (ostringstream &, ErrorObj const &) override
 
void fillUsrMsg (ostringstream &, ErrorObj const &) override
 
void fillSuffix (ostringstream &, ErrorObj const &) override
 
void routePayload (ostringstream const &, ErrorObj const &) override
 
int syslogLevel (ELseverityLevel)
 

Additional Inherited Members

- Protected Member Functions inherited from mf::service::ELdestination
std::string summarizeContext (std::string const &)
 
void emitToken (std::ostream &os, std::string const &s, bool nl=false, bool preambleMode=false)
 
std::string formSummary ()
 
bool skipMsg (ELextendedID const &)
 
void resetLimiters ()
 
void resetMsgCounters ()
 
virtual void flush ()
 
- Protected Attributes inherited from mf::service::ELdestination
ELseverityLevel threshold_
 
MsgFormatSettings format_
 
int defaultLimit_
 
int defaultReportEvery_
 
int defaultTimespan_
 
std::map< std::string const, CategoryParamscategoryParams_
 
std::map< ELextendedID const, XidLimiterxidLimiters_
 
std::map< ELextendedID const, StatsCountstatsMap_
 
bool outputStatistics_ {false}
 
bool updatedStats_ {false}
 
bool reset_ {false}
 

Detailed Description

Definition at line 28 of file syslog_mfPlugin.cc.

Member Typedef Documentation

Definition at line 35 of file syslog_mfPlugin.cc.

Constructor & Destructor Documentation

mfplugins::ELsyslog::ELsyslog ( Parameters const &  pset)

Definition at line 48 of file syslog_mfPlugin.cc.

49  : ELdestination{pset().elDestConfig()}
50  {
51  openlog("MF", 0, LOG_LOCAL0);
52  }
ELdestination(Config const &)

Member Function Documentation

void mfplugins::ELsyslog::fillPrefix ( ostringstream &  oss,
ErrorObj const &  msg 
)
overrideprivatevirtual

Reimplemented from mf::service::ELdestination.

Definition at line 55 of file syslog_mfPlugin.cc.

56  {
57  auto const& xid = msg.xid();
58  oss << format_.timestamp(msg.timestamp()) << '|' << xid.hostname() << '|'
59  << xid.hostaddr() << '|' << xid.severity().getName() << '|' << xid.id()
60  << '|' << xid.application() << '|' << xid.pid() << '|'
61  << mf::GetIteration() << '|' << xid.module() << '|';
62  }
void msg(const char *fmt,...)
Definition: message.cpp:107
string const & GetIteration()
MsgFormatSettings format_
void mfplugins::ELsyslog::fillSuffix ( ostringstream &  ,
ErrorObj const &   
)
overrideprivatevirtual

Reimplemented from mf::service::ELdestination.

Definition at line 75 of file syslog_mfPlugin.cc.

76  {}
void mfplugins::ELsyslog::fillUsrMsg ( ostringstream &  oss,
ErrorObj const &  msg 
)
overrideprivatevirtual

Reimplemented from mf::service::ELdestination.

Definition at line 65 of file syslog_mfPlugin.cc.

66  {
67  ostringstream buf;
69  string const& usrMsg =
70  !buf.str().compare(0, 1, "\n") ? buf.str().erase(0, 1) : buf.str();
71  oss << usrMsg;
72  }
virtual void fillUsrMsg(std::ostringstream &, mf::ErrorObj const &msg)
void msg(const char *fmt,...)
Definition: message.cpp:107
void mfplugins::ELsyslog::routePayload ( ostringstream const &  oss,
ErrorObj const &  msg 
)
overrideprivatevirtual

Reimplemented from mf::service::ELdestination.

Definition at line 79 of file syslog_mfPlugin.cc.

80  {
81  int const severity = syslogLevel(msg.xid().severity());
82  syslog(severity, "%s", oss.str().data());
83  }
void msg(const char *fmt,...)
Definition: message.cpp:107
int syslogLevel(ELseverityLevel)
int mfplugins::ELsyslog::syslogLevel ( ELseverityLevel  severity)
private

Definition at line 86 of file syslog_mfPlugin.cc.

87  {
88  // Following syslog levels not used:
89  // LOG_EMERG ; //0
90  // LOG_ALERT ; //1
91  // LOG_NOTICE ; //5
92  switch (severity.getLevel()) { // Used by:
94  return LOG_CRIT; // LogAbsolute, LogSystem
96  return LOG_ERR; // LogError, LogProblem
98  return LOG_WARNING; // LogPrint, LogWarning
100  return LOG_INFO; // LogInfo, LogVerbatim
102  return LOG_DEBUG; // LogDebug, LogTrace
103  default:
105  << "ELseverityLevel: " << severity
106  << " not currently supported for syslog destination\n";
107  }
108  return -1;
109  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:147
#define LOG_CRIT(stream)
Definition: Messenger.h:122
cet::coded_exception< errors::error, detail::translate > Exception
Definition: exception.h:16
#define LOG_INFO(stream)
Definition: Messenger.h:142

The documentation for this class was generated from the following file: