Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
EventLogger Class Reference

EventLogger. More...

#include <ored/utilities/log.hpp>

+ Inheritance diagram for EventLogger:
+ Collaboration diagram for EventLogger:

Public Member Functions

 EventLogger ()
 
void setFormatter (const std::function< void(const boost::log::record_view &, boost::log::formatting_ostream &)> &)
 
const QuantLib::ext::shared_ptr< file_sink > & fileSink ()
 
virtual void removeSinks () override
 Destructor. More...
 
void setFileLog (const std::string &filepath)
 
- Public Member Functions inherited from IndependentLogger
virtual ~IndependentLogger ()
 Destructor. More...
 
virtual void removeSinks ()=0
 
std::vector< std::string > & messages ()
 
void clear ()
 
const std::string & name () const
 Returns the Logger name. More...
 

Static Public Attributes

static const std::string name = "EventLogger"
 the name "EventLogger" More...
 

Private Attributes

QuantLib::ext::shared_ptr< file_sinkfileSink_
 

Additional Inherited Members

- Protected Member Functions inherited from IndependentLogger
 IndependentLogger (const std::string &name)
 Constructor. More...
 
- Protected Attributes inherited from IndependentLogger
std::vector< std::string > messages_
 

Detailed Description

EventLogger.

This logger listens for EventMessage logs from within ORE to support event logging for ORE components

Definition at line 336 of file log.hpp.

Constructor & Destructor Documentation

◆ EventLogger()

Constructor This logger will only write event logs. All other logs will be ignored.

Definition at line 343 of file log.hpp.

static const std::string name
the name "EventLogger"
Definition: log.hpp:339
IndependentLogger(const std::string &name)
Constructor.
Definition: log.hpp:281

Member Function Documentation

◆ setFormatter()

void setFormatter ( const std::function< void(const boost::log::record_view &, boost::log::formatting_ostream &)> &  formatter)

Definition at line 265 of file log.cpp.

266 {
267 if (fileSink_)
268 fileSink_->set_formatter(formatter);
269}
QuantLib::ext::shared_ptr< file_sink > fileSink_
Definition: log.hpp:352

◆ fileSink()

const QuantLib::ext::shared_ptr< file_sink > & fileSink ( )

Definition at line 346 of file log.hpp.

346{ return fileSink_; }

◆ removeSinks()

void removeSinks ( )
overridevirtual

Destructor.

Implements IndependentLogger.

Definition at line 248 of file log.cpp.

248 {
249 if (fileSink_) {
250 logging::core::get()->remove_sink(fileSink_);
251 fileSink_ = nullptr;
252 }
253}

◆ setFileLog()

void setFileLog ( const std::string &  filepath)

Definition at line 255 of file log.cpp.

255 {
256 fileSink_ = logging::add_file_log(
257 lkeywords::file_name = filepath + "%Y-%m-%d" + ".json",
258 lkeywords::time_based_rotation = lsinks::file::rotation_at_time_point(0, 0, 0), /*< at midnight >*/
259 lkeywords::filter = messageType == EventMessage::name,
260 lkeywords::scan_method = lsinks::file::scan_matching,
261 lkeywords::auto_flush = true
262 );
263}
static constexpr const char * name
Definition: log.hpp:721

Member Data Documentation

◆ name

const string name = "EventLogger"
static

the name "EventLogger"

Definition at line 339 of file log.hpp.

◆ fileSink_

QuantLib::ext::shared_ptr<file_sink> fileSink_
private

Definition at line 352 of file log.hpp.