OmniSciDB  471d68cefb
 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 166 of file Logger.h.

Constructor & Destructor Documentation

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

Definition at line 409 of file Logger.cpp.

References record_, and stream_.

410  : is_channel_(true)
411  , enum_value_(channel)
412  , record_(std::make_unique<boost::log::record>(
413  get_channel_logger(channel).open_record())) {
414  if (*record_) {
415  stream_ = std::make_unique<boost::log::record_ostream>(*record_);
416  }
417 }
int const enum_value_
Definition: Logger.h:168
std::unique_ptr< boost::log::record > record_
Definition: Logger.h:170
bool const is_channel_
Definition: Logger.h:167
ChannelLogger & get_channel_logger(Channel const channel)
Definition: Logger.cpp:396
std::unique_ptr< boost::log::record_ostream > stream_
Definition: Logger.h:171
logger::Logger::Logger ( Severity  severity)
explicit

Definition at line 419 of file Logger.cpp.

References record_, and stream_.

420  : is_channel_(false)
421  , enum_value_(severity)
422  , record_(std::make_unique<boost::log::record>(
423  gSeverityLogger::get().open_record(keywords::severity = severity))) {
424  if (*record_) {
425  stream_ = std::make_unique<boost::log::record_ostream>(*record_);
426  }
427 }
int const enum_value_
Definition: Logger.h:168
std::unique_ptr< boost::log::record > record_
Definition: Logger.h:170
bool const is_channel_
Definition: Logger.h:167
std::unique_ptr< boost::log::record_ostream > stream_
Definition: Logger.h:171
logger::Logger::Logger ( Logger &&  )
default
logger::Logger::~Logger ( )

Definition at line 429 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_.

429  {
430  if (stream_) {
431  if (is_channel_) {
432  get_channel_logger(static_cast<Channel>(enum_value_))
433  .push_record(boost::move(stream_->get_record()));
434  } else {
435  gSeverityLogger::get().push_record(boost::move(stream_->get_record()));
436  }
437  }
438  if (!is_channel_ && static_cast<Severity>(enum_value_) == Severity::FATAL) {
439  if (FatalFunc fatal_func = g_fatal_func.load()) {
440  // set_once_fatal_func() prevents race condition.
441  // Exceptions thrown by (*fatal_func)() are propagated here.
442  std::call_once(g_fatal_func_flag, *fatal_func);
443  }
444  abort();
445  }
446 }
int const enum_value_
Definition: Logger.h:168
std::once_flag g_fatal_func_flag
Definition: Logger.cpp:270
void(*)() noexcept FatalFunc
Definition: Logger.h:154
bool const is_channel_
Definition: Logger.h:167
ChannelLogger & get_channel_logger(Channel const channel)
Definition: Logger.cpp:396
std::unique_ptr< boost::log::record_ostream > stream_
Definition: Logger.h:171

+ Here is the call graph for this function:

Member Function Documentation

logger::Logger::operator bool ( ) const

Definition at line 448 of file Logger.cpp.

448  {
449  return static_cast<bool>(stream_);
450 }
std::unique_ptr< boost::log::record_ostream > stream_
Definition: Logger.h:171
boost::log::record_ostream & logger::Logger::stream ( char const file,
int  line 
)

Definition at line 474 of file Logger.cpp.

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

474  {
475  return *stream_ << query_id() << ' ' << thread_id() << ' ' << filename(file) << ':'
476  << line << ' ';
477 }
std::unique_ptr< boost::log::record_ostream > stream_
Definition: Logger.h:171
tuple line
Definition: parse_ast.py:10
ThreadId thread_id()
Definition: Logger.cpp:791
QueryId query_id()
Definition: Logger.cpp:454

+ Here is the call graph for this function:

Member Data Documentation

int const logger::Logger::enum_value_
private

Definition at line 168 of file Logger.h.

Referenced by ~Logger().

bool const logger::Logger::is_channel_
private

Definition at line 167 of file Logger.h.

Referenced by ~Logger().

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

Definition at line 170 of file Logger.h.

Referenced by Logger().

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

Definition at line 171 of file Logger.h.

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


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