OmniSciDB  c1a53651b2
 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, _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 *, 3 > 
ChannelNames {"IR", "PTX", "ASM"}
 
constexpr std::array< char, 3 > ChannelSymbols {'R', 'P', 'A'}
 
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 555 of file Logger.cpp.

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

Definition at line 340 of file Logger.cpp.

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

Definition at line 648 of file Logger.cpp.

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

Definition at line 592 of file Logger.cpp.

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

Definition at line 593 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 341 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 58 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 
_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.

313  {
314  std::stringstream ss;
315  ss << "Check failed: " << xstr << op_str << ystr << " (" << x << op_str << y << ") ";
316  return new std::string(ss.str()); // Deleted by CHECK_OP macro.
317 }
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 855 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_.

855  {
856  std::lock_guard<std::mutex> lock_guard(g_duration_tree_map_mutex);
857  auto const parent_itr = g_duration_tree_map.find(parent_thread_id);
858  CHECK(parent_itr != g_duration_tree_map.end()) << parent_thread_id;
859  auto const current_depth = parent_itr->second->currentDepth();
860  auto const emplaced = g_duration_tree_map.emplace(
862  std::make_unique<DurationTree>(g_thread_local_ids.thread_id_, current_depth + 1));
863  CHECK(emplaced.second) << "ThreadId " << g_thread_local_ids.thread_id_
864  << " already in map.";
865  parent_itr->second->pushDurationTree(*emplaced.first->second);
866 }
std::lock_guard< T > lock_guard
std::mutex g_duration_tree_map_mutex
Definition: Logger.cpp:650
thread_local ThreadLocalIds g_thread_local_ids(0, 0)
#define CHECK(condition)
Definition: Logger.h:291
DurationTreeMap g_duration_tree_map
Definition: Logger.cpp:651
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:355

+ 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:356
Severity
Definition: Logger.h:103
boost::filesystem::path logger::get_log_dir_path ( )

Definition at line 898 of file Logger.cpp.

References g_log_dir_path.

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

898  {
899  return fs::canonical(g_log_dir_path);
900 }
static fs::path g_log_dir_path
Definition: Logger.cpp:358

+ Here is the caller graph for this function:

void logger::init ( LogOptions const &  log_opts)

Definition at line 360 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().

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

+ 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 805 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().

805  {
806  std::lock_guard<std::mutex> lock_guard(g_duration_tree_map_mutex);
807  DurationTreeMap::const_iterator const itr =
809  CHECK(itr != g_duration_tree_map.cend());
810  auto const& root_duration = itr->second->rootDuration();
811  if (auto log = Logger(root_duration->severity_)) {
812  log.stream(root_duration->file_, root_duration->line_) << *itr;
813  }
814  if (json_str) {
815  JsonEncoder json_encoder;
816  *json_str = json_encoder.str(*itr);
817  }
818  EraseDurationTrees erase_duration_trees;
819  erase_duration_trees(itr);
820 }
std::lock_guard< T > lock_guard
std::mutex g_duration_tree_map_mutex
Definition: Logger.cpp:650
const std::string json_str(const rapidjson::Value &obj) noexcept
Definition: JsonAccessors.h:44
thread_local ThreadLocalIds g_thread_local_ids(0, 0)
#define CHECK(condition)
Definition: Logger.h:291
DurationTreeMap g_duration_tree_map
Definition: Logger.cpp:651
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 304 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_.

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

Definition at line 344 of file Logger.cpp.

References logger::LogOptions::severity_clog_.

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

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

653  {
654  if (g_enable_debug_timer) {
656  std::lock_guard<std::mutex> lock_guard(g_duration_tree_map_mutex);
657  auto& duration_tree_ptr = g_duration_tree_map[g_thread_local_ids.thread_id_];
658  if (!duration_tree_ptr) {
659  duration_tree_ptr =
660  std::make_unique<DurationTree>(g_thread_local_ids.thread_id_, 0);
661  }
662  return duration_tree_ptr->newDuration(debug_timer_params);
663  }
664  LOG(ERROR) << "DEBUG_TIMER(" << debug_timer_params.name_
665  << ") must not be called from the root thread(0) at "
666  << debug_timer_params.file_ << ':' << debug_timer_params.line_
667  << ". New threads require DEBUG_TIMER_NEW_THREAD() to be called first.";
668  }
669  return nullptr; // Inactive - don't measure or report timing.
670 }
std::lock_guard< T > lock_guard
std::mutex g_duration_tree_map_mutex
Definition: Logger.cpp:650
#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:651
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 272 of file Logger.cpp.

References ChannelSymbols.

274  {
275  return strm << ChannelSymbols[manip.get()];
276 }
constexpr std::array< char, 3 > 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 278 of file Logger.cpp.

References SeveritySymbols.

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

Definition at line 440 of file Logger.cpp.

References ChannelNames.

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

Definition at line 463 of file Logger.cpp.

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

Definition at line 672 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().

672  {
673  return os << std::setw(2 * duration.depth_) << ' ' << duration.value() << "ms start("
674  << duration.relative_start_time() << "ms) " << duration->name_ << ' '
675  << filename(duration->file_) << ':' << duration->line_;
676 }

+ Here is the call graph for this function:

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

Definition at line 678 of file Logger.cpp.

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

678  {
679  os << std::setw(2 * duration_tree.depth_) << ' ' << "New thread("
680  << duration_tree.thread_id_ << ')';
681  for (auto const& duration_tree_node : duration_tree.durations()) {
682  os << '\n' << duration_tree_node;
683  }
684  return os << '\n'
685  << std::setw(2 * duration_tree.depth_) << ' ' << "End thread("
686  << duration_tree.thread_id_ << ')';
687 }

+ 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 690 of file Logger.cpp.

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

Definition at line 420 of file Logger.cpp.

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

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

+ Here is the call graph for this function:

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

Definition at line 449 of file Logger.cpp.

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

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

+ Here is the call graph for this function:

RequestId logger::request_id ( )

Definition at line 868 of file Logger.cpp.

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

Referenced by DBHandler::create_table(), populate_output_stats_cols(), DBHandler::processCalciteRequest(), set_request_id(), heavyai::RequestInfo::setRequestId(), and DBHandler::sql_execute_gdf().

868  {
870 }
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 285 of file Logger.cpp.

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

Definition at line 883 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().

883  {
884  if (g_thread_local_ids.thread_id_ == 0) {
886  }
889 }
std::atomic< RequestId > g_next_request_id
Definition: Logger.cpp:468
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:469
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 390 of file Logger.cpp.

References g_fatal_func.

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

390  {
391  if (g_fatal_func.exchange(fatal_func)) {
392  throw std::runtime_error(
393  "logger::set_once_fatal_func() should not be called more than once.");
394  }
395 }
std::atomic< FatalFunc > g_fatal_func
Definition: Logger.cpp:337

+ Here is the caller graph for this function:

void logger::set_request_id ( RequestId const  request_id)

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

891  {
892  if (g_thread_local_ids.thread_id_ == 0) {
894  }
896 }
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:469
RequestId request_id()
Definition: Logger.cpp:868
ThreadId thread_id_
Definition: Logger.h:138

+ Here is the call graph for this function:

void logger::shutdown ( )

Definition at line 397 of file Logger.cpp.

References nvtx_helpers::shutdown().

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

397  {
398  static std::once_flag logger_flag;
399  std::call_once(logger_flag, []() {
400  boost::log::core::get()->remove_all_sinks();
402  });
403 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ThreadId logger::thread_id ( )

Definition at line 871 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().

871  {
873 }
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*, 3> logger::ChannelNames {"IR", "PTX", "ASM"}

Definition at line 93 of file Logger.h.

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

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

Definition at line 95 of file Logger.h.

Referenced by operator<<().

bool logger::g_any_active_channels {false}

Definition at line 355 of file Logger.cpp.

Referenced by fast_logging_check(), and init().

std::mutex logger::g_duration_tree_map_mutex

Definition at line 650 of file Logger.cpp.

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

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

Definition at line 337 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 338 of file Logger.cpp.

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

fs::path logger::g_log_dir_path
static

Definition at line 358 of file Logger.cpp.

Referenced by get_log_dir_path(), and init().

Severity logger::g_min_active_severity {Severity::FATAL}

Definition at line 356 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<<().