OmniSciDB  c0231cc57d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
logger::Logger Class Reference

#include <Logger.h>

Public Member Functions

 Logger (Channel)
 
 Logger (Severity)
 
 Logger (Logger &&)=default
 
 ~Logger ()
 
 operator bool () const
 
boost::log::record_ostream & stream (char const *file, int line)
 

Private Attributes

bool const is_channel_
 
int const enum_value_
 
std::unique_ptr
< boost::log::record > 
record_
 
std::unique_ptr
< boost::log::record_ostream > 
stream_
 

Detailed Description

Definition at line 179 of file Logger.h.

Constructor & Destructor Documentation

logger::Logger::Logger ( Channel  channel)
explicit

Definition at line 428 of file Logger.cpp.

References record_, and stream_.

429  : is_channel_(true)
430  , enum_value_(channel)
431  , record_(std::make_unique<boost::log::record>(
432  get_channel_logger(channel).open_record())) {
433  if (*record_) {
434  stream_ = std::make_unique<boost::log::record_ostream>(*record_);
435  }
436 }
int const enum_value_
Definition: Logger.h:181
std::unique_ptr< boost::log::record > record_
Definition: Logger.h:183
bool const is_channel_
Definition: Logger.h:180
ChannelLogger & get_channel_logger(Channel const channel)
Definition: Logger.cpp:415
std::unique_ptr< boost::log::record_ostream > stream_
Definition: Logger.h:184
logger::Logger::Logger ( Severity  severity)
explicit

Definition at line 438 of file Logger.cpp.

References record_, and stream_.

439  : is_channel_(false)
440  , enum_value_(severity)
441  , record_(std::make_unique<boost::log::record>(
442  gSeverityLogger::get().open_record(keywords::severity = severity))) {
443  if (*record_) {
444  stream_ = std::make_unique<boost::log::record_ostream>(*record_);
445  }
446 }
int const enum_value_
Definition: Logger.h:181
std::unique_ptr< boost::log::record > record_
Definition: Logger.h:183
bool const is_channel_
Definition: Logger.h:180
std::unique_ptr< boost::log::record_ostream > stream_
Definition: Logger.h:184
logger::Logger::Logger ( Logger &&  )
default
logger::Logger::~Logger ( )

Definition at line 448 of file Logger.cpp.

References enum_value_, logger::FATAL, logger::g_fatal_func_flag, logger::anonymous_namespace{Logger.cpp}::get_channel_logger(), is_channel_, and stream_.

448  {
449  if (stream_) {
450  if (is_channel_) {
451  get_channel_logger(static_cast<Channel>(enum_value_))
452  .push_record(boost::move(stream_->get_record()));
453  } else {
454  gSeverityLogger::get().push_record(boost::move(stream_->get_record()));
455  }
456  }
457  if (!is_channel_ && static_cast<Severity>(enum_value_) == Severity::FATAL) {
458  if (FatalFunc fatal_func = g_fatal_func.load()) {
459  // set_once_fatal_func() prevents race condition.
460  // Exceptions thrown by (*fatal_func)() are propagated here.
461  std::call_once(g_fatal_func_flag, *fatal_func);
462  }
463  abort();
464  }
465 }
int const enum_value_
Definition: Logger.h:181
std::once_flag g_fatal_func_flag
Definition: Logger.cpp:286
void(*)() noexcept FatalFunc
Definition: Logger.h:175
bool const is_channel_
Definition: Logger.h:180
ChannelLogger & get_channel_logger(Channel const channel)
Definition: Logger.cpp:415
std::unique_ptr< boost::log::record_ostream > stream_
Definition: Logger.h:184

+ Here is the call graph for this function:

Member Function Documentation

logger::Logger::operator bool ( ) const

Definition at line 467 of file Logger.cpp.

467  {
468  return static_cast<bool>(stream_);
469 }
std::unique_ptr< boost::log::record_ostream > stream_
Definition: Logger.h:184
boost::log::record_ostream & logger::Logger::stream ( char const *  file,
int  line 
)

Definition at line 493 of file Logger.cpp.

References nvtx_helpers::anonymous_namespace{nvtx_helpers.cpp}::filename(), logger::query_id(), stream_, and logger::thread_id().

493  {
494  return *stream_ << query_id() << ' ' << thread_id() << ' ' << filename(file) << ':'
495  << line << ' ';
496 }
std::unique_ptr< boost::log::record_ostream > stream_
Definition: Logger.h:184
tuple line
Definition: parse_ast.py:10
ThreadId thread_id()
Definition: Logger.cpp:820
QueryId query_id()
Definition: Logger.cpp:473

+ Here is the call graph for this function:

Member Data Documentation

int const logger::Logger::enum_value_
private

Definition at line 181 of file Logger.h.

Referenced by ~Logger().

bool const logger::Logger::is_channel_
private

Definition at line 180 of file Logger.h.

Referenced by ~Logger().

std::unique_ptr<boost::log::record> logger::Logger::record_
private

Definition at line 183 of file Logger.h.

Referenced by Logger().

std::unique_ptr<boost::log::record_ostream> logger::Logger::stream_
private

Definition at line 184 of file Logger.h.

Referenced by Logger(), stream(), and ~Logger().


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