OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
logger Namespace Reference

Namespaces

 anonymous_namespace{Logger.cpp}
 

Classes

class  Collector
 
struct  DebugTimerParams
 
class  Duration
 
class  DurationTree
 
struct  GetDepth
 
class  JsonEncoder
 
struct  EraseDurationTrees
 Depth-first search and erase all DurationTrees. Not thread-safe. More...
 
struct  ThreadLocalIds
 
class  LocalIdsScopeGuard
 
class  LogOptions
 
struct  LogShutdown
 
class  Logger
 
class  DebugTimer
 

Typedefs

using ChannelLogger = boost::log::sources::channel_logger_mt< Channel >
 
using SeverityLogger = boost::log::sources::severity_logger_mt< Severity >
 
using ClogSync = sinks::synchronous_sink< sinks::text_ostream_backend >
 
using FileSync = sinks::synchronous_sink< sinks::text_file_backend >
 
using Clock = std::chrono::steady_clock
 
using DurationTreeNode = boost::variant< Duration, DurationTree & >
 
using DurationTreeNodes = std::deque< DurationTreeNode >
 
using DurationTreeMap = std::unordered_map< ThreadId, std::unique_ptr< DurationTree >>
 
using RequestId = uint64_t
 
using ThreadId = uint64_t
 
using Channels = std::set< Channel >
 
using FatalFunc = void(*)() noexcept
 

Enumerations

enum  Channel {
  IR = 0, PTX, ASM, EXECUTOR,
  _NCHANNELS
}
 
enum  Severity {
  DEBUG4 = 0, DEBUG3, DEBUG2, DEBUG1,
  INFO, WARNING, ERROR, FATAL,
  _NSEVERITIES
}
 

Functions

 BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS (gChannelLogger_IR, ChannelLogger,(keywords::channel=IR)) BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS(gChannelLogger_PTX
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &strm, boost::log::to_log_manip< Channel, tag::channel > const &manip)
 
boost::log::formatting_ostream & operator<< (boost::log::formatting_ostream &strm, boost::log::to_log_manip< Severity, tag::severity > const &manip)
 
template<typename TAG , typename SINK >
void set_formatter (SINK &sink)
 
template<typename FILE_SINK , typename TAG >
boost::shared_ptr< FILE_SINK > make_sink (boost::shared_ptr< Collector > &collector, LogOptions const &log_opts, fs::path const &full_log_dir, TAG const tag)
 
template<typename CONSOLE_SINK >
boost::shared_ptr< CONSOLE_SINK > make_sink (LogOptions const &log_opts)
 
void init (LogOptions const &log_opts)
 
void set_once_fatal_func (FatalFunc fatal_func)
 
void shutdown ()
 
std::istream & operator>> (std::istream &in, Channels &channels)
 
std::ostream & operator<< (std::ostream &out, Channels const &channels)
 
std::istream & operator>> (std::istream &in, Severity &sev)
 
std::ostream & operator<< (std::ostream &out, Severity const &sev)
 
DurationnewDuration (DebugTimerParams const debug_timer_params)
 
std::ostream & operator<< (std::ostream &os, Duration const &duration)
 
std::ostream & operator<< (std::ostream &os, DurationTree const &duration_tree)
 
boost::log::record_ostream & operator<< (boost::log::record_ostream &os, DurationTreeMap::const_reference kv_pair)
 
void logAndEraseDurationTree (std::string *json_str)
 
void debug_timer_new_thread (ThreadId const parent_thread_id)
 
RequestId request_id ()
 
ThreadId thread_id ()
 
ThreadLocalIds thread_local_ids ()
 
RequestId set_new_request_id ()
 
void set_request_id (RequestId const request_id)
 
fs::path get_log_dir_path ()
 
bool fast_logging_check (Channel)
 
bool fast_logging_check (Severity severity)
 
template<typename X , typename Y >
BOOST_NOINLINE std::string * check_failed (X const &x, Y const &y, char const *xstr, char const *ystr, char const *op_str)
 

Variables

std::atomic< FatalFuncg_fatal_func {nullptr}
 
std::once_flag g_fatal_func_flag
 
bool g_any_active_channels {false}
 
Severity g_min_active_severity {Severity::FATAL}
 
static fs::path g_log_dir_path
 
std::mutex g_duration_tree_map_mutex
 
DurationTreeMap g_duration_tree_map
 
constexpr std::array< char
const *, 4 > 
ChannelNames {"IR", "PTX", "ASM", "EXECUTOR"}
 
constexpr std::array< char, 4 > ChannelSymbols {'R', 'P', 'A', 'X'}
 
constexpr std::array< char
const *, 8 > 
SeverityNames
 
constexpr std::array< char, 8 > SeveritySymbols {'4', '3', '2', '1', 'I', 'W', 'E', 'F'}
 

Typedef Documentation

Definition at line 53 of file Logger.cpp.

using logger::Channels = typedef std::set<Channel>

Definition at line 199 of file Logger.h.

using logger::Clock = typedef std::chrono::steady_clock

Definition at line 561 of file Logger.cpp.

using logger::ClogSync = typedef sinks::synchronous_sink<sinks::text_ostream_backend>

Definition at line 344 of file Logger.cpp.

using logger::DurationTreeMap = typedef std::unordered_map<ThreadId, std::unique_ptr<DurationTree>>

Definition at line 654 of file Logger.cpp.

using logger::DurationTreeNode = typedef boost::variant<Duration, DurationTree&>

Definition at line 598 of file Logger.cpp.

using logger::DurationTreeNodes = typedef std::deque<DurationTreeNode>

Definition at line 599 of file Logger.cpp.

using logger::FatalFunc = typedef void (*)() noexcept

Definition at line 244 of file Logger.h.

using logger::FileSync = typedef sinks::synchronous_sink<sinks::text_file_backend>

Definition at line 345 of file Logger.cpp.

using logger::RequestId = typedef uint64_t

Definition at line 131 of file Logger.h.

typedef boost::log::sources::severity_logger_mt< Severity > logger::SeverityLogger

Definition at line 59 of file Logger.cpp.

using logger::ThreadId = typedef uint64_t

Definition at line 132 of file Logger.h.

Enumeration Type Documentation

Enumerator
IR 
PTX 
ASM 
EXECUTOR 
_NCHANNELS 

Definition at line 91 of file Logger.h.

Enumerator
DEBUG4 
DEBUG3 
DEBUG2 
DEBUG1 
INFO 
WARNING 
ERROR 
FATAL 
_NSEVERITIES 

Definition at line 103 of file Logger.h.

103  {
104  DEBUG4 = 0,
105  DEBUG3,
106  DEBUG2,
107  DEBUG1,
108  INFO,
109  WARNING,
110  ERROR,
111  FATAL,
112  _NSEVERITIES // number of severity levels
113 };

Function Documentation

logger::BOOST_LOG_GLOBAL_LOGGER_CTOR_ARGS ( gChannelLogger_IR  ,
ChannelLogger  ,
(keywords::channel=IR)   
)
template<typename X , typename Y >
BOOST_NOINLINE std::string* logger::check_failed ( X const &  x,
Y const &  y,
char const *  xstr,
char const *  ystr,
char const *  op_str 
)

Definition at line 309 of file Logger.h.

References getCurrentStackTrace().

313  {
314  std::stringstream ss;
315  ss << "Check failed: " << xstr << op_str << ystr << " (" << x << op_str << y << ")\n";
316  ss << "Stack trace:\n" << getCurrentStackTrace(1, nullptr, false);
317  return new std::string(ss.str()); // Deleted by CHECK_OP macro.
318 }
std::string getCurrentStackTrace(uint32_t num_frames_to_skip, const char *stop_at_this_frame, bool skip_void_and_stl_frames)
Definition: StackTrace.cpp:26

+ Here is the call graph for this function:

void logger::debug_timer_new_thread ( ThreadId const  parent_thread_id)

Call this when a new thread is spawned that will have timers that need to be associated with timers on the parent thread. Required: g_thread_local_ids.thread_id_ is not yet in g_duration_tree_map.

Definition at line 861 of file Logger.cpp.

References CHECK, g_duration_tree_map, g_duration_tree_map_mutex, logger::anonymous_namespace{Logger.cpp}::g_thread_local_ids(), and logger::ThreadLocalIds::thread_id_.

861  {
862  std::lock_guard<std::mutex> lock_guard(g_duration_tree_map_mutex);
863  auto const parent_itr = g_duration_tree_map.find(parent_thread_id);
864  CHECK(parent_itr != g_duration_tree_map.end()) << parent_thread_id;
865  auto const current_depth = parent_itr->second->currentDepth();
866  auto const emplaced = g_duration_tree_map.emplace(
868  std::make_unique<DurationTree>(g_thread_local_ids.thread_id_, current_depth + 1));
869  CHECK(emplaced.second) << "ThreadId " << g_thread_local_ids.thread_id_
870  << " already in map.";
871  parent_itr->second->pushDurationTree(*emplaced.first->second);
872 }
std::lock_guard< T > lock_guard
std::mutex g_duration_tree_map_mutex
Definition: Logger.cpp:656
thread_local ThreadLocalIds g_thread_local_ids(0, 0)
#define CHECK(condition)
Definition: Logger.h:291
DurationTreeMap g_duration_tree_map
Definition: Logger.cpp:657
ThreadId thread_id_
Definition: Logger.h:138

+ Here is the call graph for this function:

bool logger::fast_logging_check ( Channel  )
inline

Definition at line 265 of file Logger.h.

References g_any_active_channels.

Referenced by anonymous_namespace{RelAlgOptimizer.cpp}::cleanup_dead_nodes(), fold_filters(), query_state::StdLog::log(), and query_state::StdLog::logCallStack().

265  {
266  extern bool g_any_active_channels;
267  return g_any_active_channels;
268 }
bool g_any_active_channels
Definition: Logger.cpp:359

+ Here is the caller graph for this function:

bool logger::fast_logging_check ( Severity  severity)
inline

Definition at line 270 of file Logger.h.

References g_min_active_severity.

270  {
272  return g_min_active_severity <= severity;
273 }
Severity g_min_active_severity
Definition: Logger.cpp:360
Severity
Definition: Logger.h:103
boost::filesystem::path logger::get_log_dir_path ( )

Definition at line 904 of file Logger.cpp.

References g_log_dir_path.

Referenced by Catalog_Namespace::Catalog::initializeSystemServers().

904  {
905  return fs::canonical(g_log_dir_path);
906 }
static fs::path g_log_dir_path
Definition: Logger.cpp:362

+ Here is the caller graph for this function:

void logger::init ( LogOptions const &  log_opts)

Definition at line 364 of file Logger.cpp.

References _NSEVERITIES, logger::LogOptions::channels_, logger::LogOptions::full_log_dir(), g_any_active_channels, g_log_dir_path, g_min_active_severity, INFO, nvtx_helpers::init(), LOG, logger::LogOptions::max_files_, logger::LogOptions::severity_, and logger::LogOptions::severity_clog_.

Referenced by UdfCompiler::compileFromCommandLine(), UdfCompiler::generateAST(), QueryRunner::QueryRunner::init(), CommandLineOptions::init_logging(), main(), ColumnarResults::mergeResults(), ResultSetManager::reduce(), Executor::reduceMultiDeviceResultSets(), FixedLengthEncoder< T, V >::updateStatsEncoded(), and NoneEncoder< T >::updateStatsEncoded().

364  {
365  boost::shared_ptr<boost::log::core> core = boost::log::core::get();
366  // boost::log::add_common_attributes(); // LineID TimeStamp ProcessID ThreadID
367  core->add_global_attribute("TimeStamp", attr::local_clock());
368  core->add_global_attribute("ProcessID", attr::current_process_id());
369  if (0 < log_opts.max_files_) {
370  fs::path const full_log_dir = log_opts.full_log_dir();
371  auto collector = boost::make_shared<Collector>(full_log_dir, log_opts);
372  bool const log_dir_was_created = fs::create_directory(full_log_dir);
373  // Don't create separate log sinks for anything less than Severity::INFO.
374  Severity const min_sink_level = std::max(Severity::INFO, log_opts.severity_);
375  for (int i = min_sink_level; i < Severity::_NSEVERITIES; ++i) {
376  Severity const level = static_cast<Severity>(i);
377  core->add_sink(make_sink<FileSync>(collector, log_opts, full_log_dir, level));
378  }
379  g_min_active_severity = std::min(g_min_active_severity, log_opts.severity_);
380  if (log_dir_was_created) {
381  LOG(INFO) << "Log directory(" << full_log_dir.native() << ") created.";
382  }
383  for (auto const channel : log_opts.channels_) {
384  core->add_sink(make_sink<FileSync>(collector, log_opts, full_log_dir, channel));
385  }
386  g_any_active_channels = !log_opts.channels_.empty();
387  }
388  core->add_sink(make_sink<ClogSync>(log_opts));
389  g_min_active_severity = std::min(g_min_active_severity, log_opts.severity_clog_);
391  g_log_dir_path = log_opts.full_log_dir();
392 }
#define LOG(tag)
Definition: Logger.h:285
Severity g_min_active_severity
Definition: Logger.cpp:360
static fs::path g_log_dir_path
Definition: Logger.cpp:362
Severity
Definition: Logger.h:103
bool g_any_active_channels
Definition: Logger.cpp:359

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void logger::logAndEraseDurationTree ( std::string *  json_str)

Definition at line 811 of file Logger.cpp.

References CHECK, g_duration_tree_map, g_duration_tree_map_mutex, logger::anonymous_namespace{Logger.cpp}::g_thread_local_ids(), logger::JsonEncoder::str(), and logger::ThreadLocalIds::thread_id_.

Referenced by logger::DebugTimer::stop(), and logger::DebugTimer::stopAndGetJson().

811  {
812  std::lock_guard<std::mutex> lock_guard(g_duration_tree_map_mutex);
813  DurationTreeMap::const_iterator const itr =
815  CHECK(itr != g_duration_tree_map.cend());
816  auto const& root_duration = itr->second->rootDuration();
817  if (auto log = Logger(root_duration->severity_)) {
818  log.stream(root_duration->file_, root_duration->line_) << *itr;
819  }
820  if (json_str) {
821  JsonEncoder json_encoder;
822  *json_str = json_encoder.str(*itr);
823  }
824  EraseDurationTrees erase_duration_trees;
825  erase_duration_trees(itr);
826 }
std::lock_guard< T > lock_guard
std::mutex g_duration_tree_map_mutex
Definition: Logger.cpp:656
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:46
thread_local ThreadLocalIds g_thread_local_ids(0, 0)
#define CHECK(condition)
Definition: Logger.h:291
DurationTreeMap g_duration_tree_map
Definition: Logger.cpp:657
ThreadId thread_id_
Definition: Logger.h:138

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename FILE_SINK , typename TAG >
boost::shared_ptr<FILE_SINK> logger::make_sink ( boost::shared_ptr< Collector > &  collector,
LogOptions const &  log_opts,
fs::path const &  full_log_dir,
TAG const  tag 
)

Definition at line 308 of file Logger.cpp.

References logger::LogOptions::auto_flush_, logger::LogOptions::file_name_pattern_, INFO, logger::LogOptions::rotate_daily_, logger::LogOptions::rotation_size_, logger::LogOptions::severity_, and logger::LogOptions::symlink_.

311  {
312  auto sink = boost::make_shared<FILE_SINK>(
313  keywords::file_name =
314  full_log_dir / replace_braces(log_opts.file_name_pattern_, tag),
315  keywords::auto_flush = log_opts.auto_flush_,
316  keywords::rotation_size = log_opts.rotation_size_);
317  if constexpr (std::is_same<TAG, Channel>::value) {
318  sink->set_filter(channel == static_cast<Channel>(tag));
319  set_formatter<Channel>(sink);
320  } else {
321  // INFO sink logs all other levels. Other sinks only log at their level or higher.
322  Severity const min_filter_level = static_cast<Severity>(tag) == Severity::INFO
323  ? log_opts.severity_
324  : static_cast<Severity>(tag);
325  sink->set_filter(min_filter_level <= severity);
326  set_formatter<Severity>(sink);
327  }
328  typename FILE_SINK::locked_backend_ptr backend = sink->locked_backend();
329  if (log_opts.rotate_daily_) {
330  backend->set_time_based_rotation(sinks::file::rotation_at_time_point(0, 0, 0));
331  }
332  collector->track_symlink(full_log_dir / replace_braces(log_opts.symlink_, tag));
333  backend->set_file_collector(collector);
334  backend->set_open_handler(create_or_replace_symlink(
335  boost::weak_ptr<FILE_SINK>(sink), replace_braces(log_opts.symlink_, tag)));
336  backend->scan_for_files();
337  return sink;
338 }
Severity
Definition: Logger.h:103
template<typename CONSOLE_SINK >
boost::shared_ptr<CONSOLE_SINK> logger::make_sink ( LogOptions const &  log_opts)

Definition at line 348 of file Logger.cpp.

References logger::LogOptions::severity_clog_.

348  {
349  auto sink = boost::make_shared<CONSOLE_SINK>();
350  boost::shared_ptr<std::ostream> clog(&std::clog, boost::null_deleter());
351  sink->locked_backend()->add_stream(clog);
352  sink->set_filter(log_opts.severity_clog_ <= severity);
353  set_formatter<Severity>(sink);
354  return sink;
355 }
Duration* logger::newDuration ( DebugTimerParams const  debug_timer_params)

Definition at line 659 of file Logger.cpp.

References ERROR, logger::DebugTimerParams::file_, g_duration_tree_map, g_duration_tree_map_mutex, g_enable_debug_timer, logger::anonymous_namespace{Logger.cpp}::g_thread_local_ids(), logger::DebugTimerParams::line_, LOG, logger::DebugTimerParams::name_, and logger::ThreadLocalIds::thread_id_.

659  {
660  if (g_enable_debug_timer) {
662  std::lock_guard<std::mutex> lock_guard(g_duration_tree_map_mutex);
663  auto& duration_tree_ptr = g_duration_tree_map[g_thread_local_ids.thread_id_];
664  if (!duration_tree_ptr) {
665  duration_tree_ptr =
666  std::make_unique<DurationTree>(g_thread_local_ids.thread_id_, 0);
667  }
668  return duration_tree_ptr->newDuration(debug_timer_params);
669  }
670  LOG(ERROR) << "DEBUG_TIMER(" << debug_timer_params.name_
671  << ") must not be called from the root thread(0) at "
672  << debug_timer_params.file_ << ':' << debug_timer_params.line_
673  << ". New threads require DEBUG_TIMER_NEW_THREAD() to be called first.";
674  }
675  return nullptr; // Inactive - don't measure or report timing.
676 }
std::lock_guard< T > lock_guard
std::mutex g_duration_tree_map_mutex
Definition: Logger.cpp:656
#define LOG(tag)
Definition: Logger.h:285
bool g_enable_debug_timer
Definition: Logger.cpp:17
thread_local ThreadLocalIds g_thread_local_ids(0, 0)
DurationTreeMap g_duration_tree_map
Definition: Logger.cpp:657
ThreadId thread_id_
Definition: Logger.h:138

+ Here is the call graph for this function:

boost::log::formatting_ostream& logger::operator<< ( boost::log::formatting_ostream &  strm,
boost::log::to_log_manip< Channel, tag::channel > const &  manip 
)

Definition at line 276 of file Logger.cpp.

References ChannelSymbols.

278  {
279  return strm << ChannelSymbols[manip.get()];
280 }
constexpr std::array< char, 4 > ChannelSymbols
Definition: Logger.h:95
boost::log::formatting_ostream& logger::operator<< ( boost::log::formatting_ostream &  strm,
boost::log::to_log_manip< Severity, tag::severity > const &  manip 
)

Definition at line 282 of file Logger.cpp.

References SeveritySymbols.

284  {
285  return strm << SeveritySymbols[manip.get()];
286 }
constexpr std::array< char, 8 > SeveritySymbols
Definition: Logger.h:124
std::ostream& logger::operator<< ( std::ostream &  out,
Channels const &  channels 
)

Definition at line 444 of file Logger.cpp.

References ChannelNames.

444  {
445  int i = 0;
446  for (auto const channel : channels) {
447  out << (i++ ? " " : "") << ChannelNames.at(channel);
448  }
449  return out;
450 }
constexpr std::array< char const *, 4 > ChannelNames
Definition: Logger.h:93
std::ostream& logger::operator<< ( std::ostream &  out,
Severity const &  sev 
)

Definition at line 467 of file Logger.cpp.

467  {
468  return out << SeverityNames.at(sev);
469 }
constexpr std::array< char const *, 8 > SeverityNames
Definition: Logger.h:115
std::ostream& logger::operator<< ( std::ostream &  os,
Duration const &  duration 
)

Definition at line 678 of file Logger.cpp.

References logger::Duration::depth_, logger::DebugTimerParams::file_, nvtx_helpers::anonymous_namespace{nvtx_helpers.cpp}::filename(), logger::DebugTimerParams::line_, logger::DebugTimerParams::name_, logger::Duration::relative_start_time(), and logger::Duration::value().

678  {
679  return os << std::setw(2 * duration.depth_) << ' ' << duration.value() << "ms start("
680  << duration.relative_start_time() << "ms) " << duration->name_ << ' '
681  << filename(duration->file_) << ':' << duration->line_;
682 }

+ Here is the call graph for this function:

std::ostream& logger::operator<< ( std::ostream &  os,
DurationTree const &  duration_tree 
)

Definition at line 684 of file Logger.cpp.

References logger::DurationTree::depth_, logger::DurationTree::durations(), and logger::DurationTree::thread_id_.

684  {
685  os << std::setw(2 * duration_tree.depth_) << ' ' << "New thread("
686  << duration_tree.thread_id_ << ')';
687  for (auto const& duration_tree_node : duration_tree.durations()) {
688  os << '\n' << duration_tree_node;
689  }
690  return os << '\n'
691  << std::setw(2 * duration_tree.depth_) << ' ' << "End thread("
692  << duration_tree.thread_id_ << ')';
693 }

+ Here is the call graph for this function:

boost::log::record_ostream& logger::operator<< ( boost::log::record_ostream &  os,
DurationTreeMap::const_reference  kv_pair 
)

Definition at line 696 of file Logger.cpp.

697  {
698  auto itr = kv_pair.second->durations().cbegin();
699  auto const end = kv_pair.second->durations().cend();
700  auto const& root_duration = boost::get<Duration>(*itr);
701  os << "DEBUG_TIMER thread_id(" << kv_pair.first << ")\n"
702  << root_duration.value() << "ms total duration for " << root_duration->name_;
703  for (++itr; itr != end; ++itr) {
704  os << '\n' << *itr;
705  }
706  return os;
707 }
std::istream& logger::operator>> ( std::istream &  in,
Channels &  channels 
)

Definition at line 424 of file Logger.cpp.

References ChannelNames, parse_ast::line, and logger::anonymous_namespace{Logger.cpp}::unquote().

424  {
425  std::string line;
426  std::getline(in, line);
427  unquote(line);
428  std::regex const rex(R"(\w+)");
429  using TokenItr = std::regex_token_iterator<std::string::iterator>;
430  TokenItr const end;
431  for (TokenItr tok(line.begin(), line.end(), rex); tok != end; ++tok) {
432  auto itr = std::find(ChannelNames.cbegin(), ChannelNames.cend(), *tok);
433  if (itr == ChannelNames.cend()) {
434  in.setstate(std::ios_base::failbit);
435  break;
436  } else {
437  channels.emplace(static_cast<Channel>(itr - ChannelNames.cbegin()));
438  }
439  }
440  return in;
441 }
constexpr std::array< char const *, 4 > ChannelNames
Definition: Logger.h:93
tuple line
Definition: parse_ast.py:10
void unquote(std::string &str)
Definition: Logger.cpp:413

+ Here is the call graph for this function:

std::istream& logger::operator>> ( std::istream &  in,
Severity &  sev 
)

Definition at line 453 of file Logger.cpp.

References logger::anonymous_namespace{Logger.cpp}::unquote().

453  {
454  std::string token;
455  in >> token;
456  unquote(token);
457  auto itr = std::find(SeverityNames.cbegin(), SeverityNames.cend(), token);
458  if (itr == SeverityNames.cend()) {
459  in.setstate(std::ios_base::failbit);
460  } else {
461  sev = static_cast<Severity>(itr - SeverityNames.cbegin());
462  }
463  return in;
464 }
Severity
Definition: Logger.h:103
constexpr std::array< char const *, 8 > SeverityNames
Definition: Logger.h:115
void unquote(std::string &str)
Definition: Logger.cpp:413

+ Here is the call graph for this function:

RequestId logger::request_id ( )

Definition at line 874 of file Logger.cpp.

References logger::anonymous_namespace{Logger.cpp}::g_thread_local_ids(), and logger::ThreadLocalIds::request_id_.

Referenced by ExecutorResourceMgr_Namespace::ExecutorResourceMgr::choose_next_request(), DBHandler::create_table(), ExecutorResourceMgr_Namespace::ExecutorResourceMgr::enqueue_request(), ExecutorResourceMgr_Namespace::ExecutorResourceMgr::get_chunk_request_info(), ExecutorResourceMgr_Namespace::ExecutorResourceMgr::get_request_for_id(), ExecutorResourceMgr_Namespace::OutstandingQueueRequests::get_semaphore_for_request(), ExecutorResourceMgr_Namespace::ExecutorResourceMgr::mark_request_dequed(), ExecutorResourceMgr_Namespace::ExecutorResourceMgr::mark_request_error(), ExecutorResourceMgr_Namespace::ExecutorResourceMgr::mark_request_finished(), ExecutorResourceMgr_Namespace::ExecutorResourceMgr::mark_request_timed_out(), populate_output_stats_cols(), DBHandler::processCalciteRequest(), ExecutorResourceMgr_Namespace::ExecutorResourceMgr::request_resources_with_timeout(), set_request_id(), heavyai::RequestInfo::setRequestId(), DBHandler::sql_execute_gdf(), and ExecutorResourceMgr_Namespace::OutstandingQueueRequests::wake_request_by_id().

874  {
876 }
RequestId request_id_
Definition: Logger.h:137
thread_local ThreadLocalIds g_thread_local_ids(0, 0)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename TAG , typename SINK >
void logger::set_formatter ( SINK &  sink)

Definition at line 289 of file Logger.cpp.

289  {
290  if constexpr (std::is_same<TAG, Channel>::value) {
291  sink->set_formatter(
292  expr::stream << expr::format_date_time<boost::posix_time::ptime>(
293  "TimeStamp", "%Y-%m-%dT%H:%M:%S.%f")
294  << ' ' << channel << ' '
295  << boost::phoenix::bind(&get_native_process_id, process_id.or_none())
296  << ' ' << expr::smessage);
297  } else {
298  sink->set_formatter(
299  expr::stream << expr::format_date_time<boost::posix_time::ptime>(
300  "TimeStamp", "%Y-%m-%dT%H:%M:%S.%f")
301  << ' ' << severity << ' '
302  << boost::phoenix::bind(&get_native_process_id, process_id.or_none())
303  << ' ' << expr::smessage);
304  }
305 }
RequestId logger::set_new_request_id ( )

Definition at line 889 of file Logger.cpp.

References logger::anonymous_namespace{Logger.cpp}::g_next_request_id, logger::anonymous_namespace{Logger.cpp}::g_next_thread_id, logger::anonymous_namespace{Logger.cpp}::g_thread_local_ids(), logger::ThreadLocalIds::request_id_, and logger::ThreadLocalIds::thread_id_.

Referenced by DBHandler::connect(), and DBHandler::internal_connect().

889  {
890  if (g_thread_local_ids.thread_id_ == 0) {
892  }
895 }
std::atomic< RequestId > g_next_request_id
Definition: Logger.cpp:472
RequestId request_id_
Definition: Logger.h:137
thread_local ThreadLocalIds g_thread_local_ids(0, 0)
std::atomic< ThreadId > g_next_thread_id
Definition: Logger.cpp:473
ThreadId thread_id_
Definition: Logger.h:138

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void logger::set_once_fatal_func ( FatalFunc  fatal_func)

Definition at line 394 of file Logger.cpp.

References g_fatal_func.

Referenced by QueryRunner::QueryRunner::QueryRunner().

394  {
395  if (g_fatal_func.exchange(fatal_func)) {
396  throw std::runtime_error(
397  "logger::set_once_fatal_func() should not be called more than once.");
398  }
399 }
std::atomic< FatalFunc > g_fatal_func
Definition: Logger.cpp:341

+ Here is the caller graph for this function:

void logger::set_request_id ( RequestId const  request_id)

Definition at line 897 of file Logger.cpp.

References logger::anonymous_namespace{Logger.cpp}::g_next_thread_id, logger::anonymous_namespace{Logger.cpp}::g_thread_local_ids(), request_id(), logger::ThreadLocalIds::request_id_, and logger::ThreadLocalIds::thread_id_.

897  {
898  if (g_thread_local_ids.thread_id_ == 0) {
900  }
902 }
RequestId request_id_
Definition: Logger.h:137
thread_local ThreadLocalIds g_thread_local_ids(0, 0)
std::atomic< ThreadId > g_next_thread_id
Definition: Logger.cpp:473
RequestId request_id()
Definition: Logger.cpp:874
ThreadId thread_id_
Definition: Logger.h:138

+ Here is the call graph for this function:

void logger::shutdown ( )

Definition at line 401 of file Logger.cpp.

References nvtx_helpers::shutdown().

Referenced by heartbeat(), EmbeddedDatabase::DBEngineImpl::reset(), TestProcessSignalHandler::shutdownSubsystemsAndExit(), startHeavyDBServer(), and logger::LogShutdown::~LogShutdown().

401  {
402  static std::once_flag logger_flag;
403  std::call_once(logger_flag, []() {
404  boost::log::core::get()->remove_all_sinks();
406  });
407 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ThreadId logger::thread_id ( )

Definition at line 877 of file Logger.cpp.

References logger::anonymous_namespace{Logger.cpp}::g_thread_local_ids(), and logger::ThreadLocalIds::thread_id_.

Referenced by import_export::import_thread_delimited(), import_export::import_thread_shapefile(), import_export::Importer::importDelimited(), import_export::Importer::importGDALGeo(), import_export::Importer::importGDALRaster(), foreign_storage::LazyParquetChunkLoader::loadRowGroups(), nvtx_helpers::name_current_thread(), StringDictionary::populate_string_array_ids(), and Parser::InsertIntoTableAsSelectStmt::populateData().

877  {
879 }
thread_local ThreadLocalIds g_thread_local_ids(0, 0)
ThreadId thread_id_
Definition: Logger.h:138

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ThreadLocalIds logger::thread_local_ids ( )

Variable Documentation

constexpr std::array<char const*, 4> logger::ChannelNames {"IR", "PTX", "ASM", "EXECUTOR"}

Definition at line 93 of file Logger.h.

Referenced by operator<<(), and operator>>().

constexpr std::array<char, 4> logger::ChannelSymbols {'R', 'P', 'A', 'X'}

Definition at line 95 of file Logger.h.

Referenced by operator<<().

bool logger::g_any_active_channels {false}

Definition at line 359 of file Logger.cpp.

Referenced by fast_logging_check(), and init().

std::mutex logger::g_duration_tree_map_mutex

Definition at line 656 of file Logger.cpp.

Referenced by debug_timer_new_thread(), logAndEraseDurationTree(), and newDuration().

std::atomic<FatalFunc> logger::g_fatal_func {nullptr}

Definition at line 341 of file Logger.cpp.

Referenced by set_once_fatal_func(), and logger::Logger::~Logger().

std::once_flag logger::g_fatal_func_flag

Definition at line 342 of file Logger.cpp.

Referenced by logger::Logger::~Logger().

fs::path logger::g_log_dir_path
static

Definition at line 362 of file Logger.cpp.

Referenced by get_log_dir_path(), and init().

Severity logger::g_min_active_severity {Severity::FATAL}

Definition at line 360 of file Logger.cpp.

Referenced by fast_logging_check(), and init().

constexpr std::array<char const*, 8> logger::SeverityNames
Initial value:
{"DEBUG4",
"DEBUG3",
"DEBUG2",
"DEBUG1",
"INFO",
"WARNING",
"ERROR",
"FATAL"}

Definition at line 115 of file Logger.h.

constexpr std::array<char, 8> logger::SeveritySymbols {'4', '3', '2', '1', 'I', 'W', 'E', 'F'}

Definition at line 124 of file Logger.h.

Referenced by operator<<().