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

Classes

class  Duration
 
class  DurationTree
 
struct  EraseDurationTrees
 
class  LogOptions
 
struct  LogShutdown
 
class  Logger
 
class  DebugTimer
 

Typedefs

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 DurationTreeMap = std::unordered_map< std::thread::id, std::unique_ptr< DurationTree >>
 
using Channels = std::set< Channel >
 
using FatalFunc ) = void(*)(
 
using ChannelLogger = boost::log::sources::channel_logger_mt< Channel >
 
using SeverityLogger = boost::log::sources::severity_logger_mt< Severity >
 

Enumerations

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

Functions

std::string filename (char const *path)
 
template<typename TAG >
std::string replace_braces (std::string const &str, TAG const tag)
 
boost::log::attributes::current_process_id::value_type::native_type get_native_process_id (boost::log::value_ref< boost::log::attributes::current_process_id::value_type, tag::process_id > const &pid)
 
template<typename SINK >
sinks::text_file_backend::open_handler_type create_or_replace_symlink (boost::weak_ptr< SINK > weak_ptr, std::string &&symlink)
 
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 (LogOptions const &log_opts, boost::filesystem::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)
 
template<typename... Ts>
DurationnewDuration (Severity severity, Ts &&...args)
 
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::thread::id const thread_id)
 
void debugTimerNewThread (std::thread::id parent_thread_id)
 
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}
 
std::mutex gDurationTreeMapMutex
 
DurationTreeMap gDurationTreeMap
 
constexpr std::array< char
const *, 2 > 
ChannelNames {"IR", "PTX"}
 
constexpr std::array< char, 2 > ChannelSymbols {'R', 'P'}
 
constexpr std::array< char
const *, 8 > 
SeverityNames
 
constexpr std::array< char, 8 > SeveritySymbols {'4', '3', '2', '1', 'I', 'W', 'E', 'F'}
 

Typedef Documentation

using logger::ChannelLogger = typedef boost::log::sources::channel_logger_mt<Channel>

Definition at line 147 of file Logger.h.

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

Definition at line 103 of file Logger.h.

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

Definition at line 397 of file Logger.cpp.

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

Definition at line 247 of file Logger.cpp.

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

Definition at line 473 of file Logger.cpp.

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

Definition at line 433 of file Logger.cpp.

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

Definition at line 144 of file Logger.h.

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

Definition at line 248 of file Logger.cpp.

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

Definition at line 150 of file Logger.h.

Enumeration Type Documentation

Enumerator
IR 
PTX 
_NCHANNELS 

Definition at line 61 of file Logger.h.

61 { IR = 0, PTX, _NCHANNELS };
Enumerator
DEBUG4 
DEBUG3 
DEBUG2 
DEBUG1 
INFO 
WARNING 
ERROR 
FATAL 
_NSEVERITIES 

Definition at line 73 of file Logger.h.

73  {
74  DEBUG4 = 0,
75  DEBUG3,
76  DEBUG2,
77  DEBUG1,
78  INFO,
79  WARNING,
80  ERROR,
81  FATAL,
82  _NSEVERITIES // number of severity levels
83 };

Function Documentation

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 206 of file Logger.h.

210  {
211  std::stringstream ss;
212  ss << "Check failed: " << xstr << op_str << ystr << " (" << x << op_str << y << ") ";
213  return new std::string(ss.str()); // Deleted by CHECK_OP macro.
214 }
template<typename SINK >
sinks::text_file_backend::open_handler_type logger::create_or_replace_symlink ( boost::weak_ptr< SINK >  weak_ptr,
std::string &&  symlink 
)

Definition at line 156 of file Logger.cpp.

References error_code, and filename().

Referenced by make_sink().

158  {
159  namespace fs = boost::filesystem;
160  return [weak_ptr,
161  symlink = std::move(symlink)](sinks::text_file_backend::stream_type& stream) {
162  if (boost::shared_ptr<SINK> sink = weak_ptr.lock()) {
164  fs::path const& file_name = sink->locked_backend()->get_current_file_name();
165  fs::path const symlink_path = file_name.parent_path() / symlink;
166  fs::remove(symlink_path, ec);
167  if (ec) {
168  stream << filename(__FILE__) << ':' << __LINE__ << ' ' << ec.message() << '\n';
169  }
170  fs::create_symlink(file_name.filename(), symlink_path, ec);
171  if (ec) {
172  stream << filename(__FILE__) << ':' << __LINE__ << ' ' << ec.message() << '\n';
173  }
174  }
175  };
176 }
std::string filename(char const *path)
Definition: Logger.cpp:58
const int8_t const int64_t const uint64_t const int32_t const int64_t int64_t uint32_t const int64_t int32_t * error_code

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void logger::debugTimerNewThread ( std::thread::id  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.

Definition at line 569 of file Logger.cpp.

References g_enable_debug_timer, gDurationTreeMap, and gDurationTreeMapMutex.

569  {
570  if (g_enable_debug_timer) {
571  auto const thread_id = std::this_thread::get_id();
572  if (thread_id != parent_thread_id) {
573  std::lock_guard<std::mutex> lock_guard(gDurationTreeMapMutex);
574  auto parent_itr = gDurationTreeMap.find(parent_thread_id);
575  if (parent_itr != gDurationTreeMap.end()) {
576  auto& duration_tree_ptr = gDurationTreeMap[thread_id];
577  if (!duration_tree_ptr) {
578  auto const current_depth = parent_itr->second->currentDepth();
579  duration_tree_ptr =
580  std::make_unique<DurationTree>(thread_id, current_depth + 1);
581  parent_itr->second->pushDurationTree(*duration_tree_ptr);
582  }
583  }
584  }
585  }
586 }
bool g_enable_debug_timer
Definition: Logger.cpp:17
std::mutex gDurationTreeMapMutex
Definition: Logger.cpp:475
DurationTreeMap gDurationTreeMap
Definition: Logger.cpp:476
bool logger::fast_logging_check ( Channel  )
inline

Definition at line 171 of file Logger.h.

References g_any_active_channels.

Referenced by query_state::StdLog::log(), and query_state::StdLog::logCallStack().

171  {
172  extern bool g_any_active_channels;
173  return g_any_active_channels;
174 }
bool g_any_active_channels
Definition: Logger.cpp:262

+ Here is the caller graph for this function:

bool logger::fast_logging_check ( Severity  severity)
inline

Definition at line 176 of file Logger.h.

References g_min_active_severity.

176  {
178  return g_min_active_severity <= severity;
179 }
Severity g_min_active_severity
Definition: Logger.cpp:263
Severity
Definition: Logger.h:73
std::string logger::filename ( char const *  path)

Definition at line 58 of file Logger.cpp.

Referenced by create_or_replace_symlink(), com.omnisci.jdbc.KeyLoader::getDetails_pkcs12(), logger::LogOptions::LogOptions(), operator<<(), path_has_valid_filename(), File_Namespace::removeFile(), QueryRunner::QueryRunner::setIRFilename(), and logger::Logger::stream().

58  {
59  return boost::filesystem::path(path).filename().string();
60 }

+ Here is the caller graph for this function:

boost::log::attributes::current_process_id::value_type::native_type logger::get_native_process_id ( boost::log::value_ref< boost::log::attributes::current_process_id::value_type, tag::process_id > const &  pid)

Definition at line 149 of file Logger.cpp.

Referenced by set_formatter().

151  {
152  return pid ? pid->native_id() : 0;
153 }

+ Here is the caller graph for this function:

void logger::init ( LogOptions const &  log_opts)

Definition at line 265 of file Logger.cpp.

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

Referenced by QueryRunner::QueryRunner::init(), MapDProgramOptions::init_logging(), main(), ColumnarResults::mergeResults(), ResultSetManager::reduce(), and Executor::reduceMultiDeviceResultSets().

265  {
266  boost::shared_ptr<boost::log::core> core = boost::log::core::get();
267  // boost::log::add_common_attributes(); // LineID TimeStamp ProcessID ThreadID
268  core->add_global_attribute("TimeStamp", attr::local_clock());
269  core->add_global_attribute("ProcessID", attr::current_process_id());
270  if (0 < log_opts.max_files_) {
271  boost::filesystem::path const full_log_dir = log_opts.full_log_dir();
272  bool const log_dir_was_created = boost::filesystem::create_directory(full_log_dir);
273  // Don't create separate log sinks for anything less than Severity::INFO.
274  Severity const min_sink_level = std::max(Severity::INFO, log_opts.severity_);
275  for (int i = min_sink_level; i < Severity::_NSEVERITIES; ++i) {
276  Severity const level = static_cast<Severity>(i);
277  core->add_sink(make_sink<FileSync>(log_opts, full_log_dir, level));
278  }
279  g_min_active_severity = std::min(g_min_active_severity, log_opts.severity_);
280  if (log_dir_was_created) {
281  LOG(INFO) << "Log directory(" << full_log_dir.native() << ") created.";
282  }
283  for (auto const channel : log_opts.channels_) {
284  core->add_sink(make_sink<FileSync>(log_opts, full_log_dir, channel));
285  }
286  g_any_active_channels = !log_opts.channels_.empty();
287  }
288  core->add_sink(make_sink<ClogSync>(log_opts));
289  g_min_active_severity = std::min(g_min_active_severity, log_opts.severity_clog_);
290 }
#define LOG(tag)
Definition: Logger.h:185
Severity g_min_active_severity
Definition: Logger.cpp:263
Severity
Definition: Logger.h:73
bool g_any_active_channels
Definition: Logger.cpp:262

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void logger::logAndEraseDurationTree ( std::thread::id const  thread_id)

Definition at line 539 of file Logger.cpp.

References CHECK(), gDurationTreeMap, and gDurationTreeMapMutex.

Referenced by logger::DebugTimer::stop().

539  {
540  std::lock_guard<std::mutex> lock_guard(gDurationTreeMapMutex);
541  DurationTreeMap::const_iterator const itr = gDurationTreeMap.find(thread_id);
542  CHECK(itr != gDurationTreeMap.cend());
543  auto const& base_duration = itr->second->baseDuration();
544  if (auto log = Logger(base_duration.severity_)) {
545  log.stream(base_duration.file_, base_duration.line_) << *itr;
546  }
547  EraseDurationTrees const tree_trimmer;
548  tree_trimmer(itr);
549 }
CHECK(cgen_state)
std::mutex gDurationTreeMapMutex
Definition: Logger.cpp:475
DurationTreeMap gDurationTreeMap
Definition: Logger.cpp:476

+ 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 ( LogOptions const &  log_opts,
boost::filesystem::path const &  full_log_dir,
TAG const  tag 
)

Definition at line 210 of file Logger.cpp.

References logger::LogOptions::auto_flush_, create_or_replace_symlink(), logger::LogOptions::file_name_pattern_, INFO, logger::LogOptions::max_files_, logger::LogOptions::min_free_space_, replace_braces(), logger::LogOptions::rotate_daily_, logger::LogOptions::rotation_size_, logger::LogOptions::severity_, and logger::LogOptions::symlink_.

212  {
213  auto sink = boost::make_shared<FILE_SINK>(
214  keywords::file_name =
215  full_log_dir / replace_braces(log_opts.file_name_pattern_, tag),
216  keywords::auto_flush = log_opts.auto_flush_,
217  keywords::rotation_size = log_opts.rotation_size_);
218  if /*constexpr*/ (std::is_same<TAG, Channel>::value) {
219  sink->set_filter(channel == static_cast<Channel>(tag));
220  set_formatter<Channel>(sink);
221  } else {
222  // INFO sink logs all other levels. Other sinks only log at their level or higher.
223  Severity const min_filter_level = static_cast<Severity>(tag) == Severity::INFO
224  ? log_opts.severity_
225  : static_cast<Severity>(tag);
226  sink->set_filter(min_filter_level <= severity);
227  set_formatter<Severity>(sink);
228  }
229  typename FILE_SINK::locked_backend_ptr backend = sink->locked_backend();
230  if (log_opts.rotate_daily_) {
231  backend->set_time_based_rotation(sinks::file::rotation_at_time_point(0, 0, 0));
232  }
233  backend->set_file_collector(
234  sinks::file::make_collector(keywords::target = full_log_dir,
235  keywords::max_files = log_opts.max_files_,
236  keywords::min_free_space = log_opts.min_free_space_));
237  backend->set_open_handler(create_or_replace_symlink(
238  boost::weak_ptr<FILE_SINK>(sink), replace_braces(log_opts.symlink_, tag)));
239  backend->scan_for_files();
240  return sink;
241 }
std::string replace_braces(std::string const &str, TAG const tag)
Definition: Logger.cpp:138
sinks::text_file_backend::open_handler_type create_or_replace_symlink(boost::weak_ptr< SINK > weak_ptr, std::string &&symlink)
Definition: Logger.cpp:156
Severity
Definition: Logger.h:73

+ Here is the call graph for this function:

template<typename CONSOLE_SINK >
boost::shared_ptr<CONSOLE_SINK> logger::make_sink ( LogOptions const &  log_opts)

Definition at line 251 of file Logger.cpp.

References logger::LogOptions::severity_clog_.

251  {
252  auto sink = boost::make_shared<CONSOLE_SINK>();
253  boost::shared_ptr<std::ostream> clog(&std::clog, boost::null_deleter());
254  sink->locked_backend()->add_stream(clog);
255  sink->set_filter(log_opts.severity_clog_ <= severity);
256  set_formatter<Severity>(sink);
257  return sink;
258 }
template<typename... Ts>
Duration* logger::newDuration ( Severity  severity,
Ts &&...  args 
)

Definition at line 479 of file Logger.cpp.

References run_benchmark_import::args, g_enable_debug_timer, gDurationTreeMap, and gDurationTreeMapMutex.

479  {
480  if (g_enable_debug_timer) {
481  auto const thread_id = std::this_thread::get_id();
482  std::lock_guard<std::mutex> lock_guard(gDurationTreeMapMutex);
483  auto& duration_tree_ptr = gDurationTreeMap[thread_id];
484  if (!duration_tree_ptr) {
485  duration_tree_ptr = std::make_unique<DurationTree>(thread_id, 0);
486  }
487  return duration_tree_ptr->newDuration(severity, std::forward<Ts>(args)...);
488  }
489  return nullptr; // Inactive - don't measure or report timing.
490 }
bool g_enable_debug_timer
Definition: Logger.cpp:17
std::mutex gDurationTreeMapMutex
Definition: Logger.cpp:475
DurationTreeMap gDurationTreeMap
Definition: Logger.cpp:476
boost::log::formatting_ostream& logger::operator<< ( boost::log::formatting_ostream &  strm,
boost::log::to_log_manip< Channel, tag::channel > const &  manip 
)

Definition at line 178 of file Logger.cpp.

References ChannelSymbols.

180  {
181  return strm << ChannelSymbols[manip.get()];
182 }
constexpr std::array< char, 2 > ChannelSymbols
Definition: Logger.h:65
boost::log::formatting_ostream& logger::operator<< ( boost::log::formatting_ostream &  strm,
boost::log::to_log_manip< Severity, tag::severity > const &  manip 
)

Definition at line 184 of file Logger.cpp.

References SeveritySymbols.

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

Definition at line 323 of file Logger.cpp.

References ChannelNames, and out.

323  {
324  int i = 0;
325  for (auto const channel : channels) {
326  out << (i++ ? " " : "") << ChannelNames.at(channel);
327  }
328  return out;
329 }
constexpr std::array< char const *, 2 > ChannelNames
Definition: Logger.h:63
const int8_t const int64_t const uint64_t const int32_t const int64_t int64_t ** out
std::ostream& logger::operator<< ( std::ostream &  out,
Severity const &  sev 
)

Definition at line 345 of file Logger.cpp.

References SeverityNames.

345  {
346  return out << SeverityNames.at(sev);
347 }
constexpr std::array< char const *, 8 > SeverityNames
Definition: Logger.h:85
const int8_t const int64_t const uint64_t const int32_t const int64_t int64_t ** out
std::ostream& logger::operator<< ( std::ostream &  os,
Duration const &  duration 
)

Definition at line 492 of file Logger.cpp.

References logger::Duration::depth_, logger::Duration::file_, filename(), logger::Duration::line_, logger::Duration::name_, and logger::Duration::value().

492  {
493  return os << std::setw(2 * duration.depth_) << ' ' << duration.value() << "ms "
494  << duration.name_ << ' ' << filename(duration.file_) << ':' << duration.line_;
495 }
std::string filename(char const *path)
Definition: Logger.cpp:58

+ Here is the call graph for this function:

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

Definition at line 497 of file Logger.cpp.

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

497  {
498  os << std::setw(2 * duration_tree.depth_) << ' ' << "New thread("
499  << duration_tree.thread_id_ << ')';
500  for (auto const& duration_tree_node : duration_tree.durations()) {
501  os << '\n' << duration_tree_node;
502  }
503  return os << '\n'
504  << std::setw(2 * duration_tree.depth_) << ' ' << "End thread("
505  << duration_tree.thread_id_ << ')';
506 }

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

510  {
511  auto itr = kv_pair.second->durations().cbegin();
512  auto const end = kv_pair.second->durations().cend();
513  auto const& base_duration = boost::get<Duration>(*itr);
514  os << "DEBUG_TIMER thread_id(" << kv_pair.first << ")\n"
515  << base_duration.value() << "ms total duration for " << base_duration.name_;
516  for (++itr; itr != end; ++itr) {
517  os << '\n' << *itr;
518  }
519  return os;
520 }
std::istream& logger::operator>> ( std::istream &  in,
Channels &  channels 
)

Definition at line 304 of file Logger.cpp.

References ChannelNames.

304  {
305  std::string line;
306  std::getline(in, line);
307  std::regex const rex(R"(\w+)");
308  using TokenItr = std::regex_token_iterator<std::string::iterator>;
309  TokenItr const end;
310  for (TokenItr tok(line.begin(), line.end(), rex); tok != end; ++tok) {
311  auto itr = std::find(ChannelNames.cbegin(), ChannelNames.cend(), *tok);
312  if (itr == ChannelNames.cend()) {
313  in.setstate(std::ios_base::failbit);
314  break;
315  } else {
316  channels.emplace(static_cast<Channel>(itr - ChannelNames.cbegin()));
317  }
318  }
319  return in;
320 }
constexpr std::array< char const *, 2 > ChannelNames
Definition: Logger.h:63
std::istream& logger::operator>> ( std::istream &  in,
Severity &  sev 
)

Definition at line 332 of file Logger.cpp.

References SeverityNames.

332  {
333  std::string token;
334  in >> token;
335  auto itr = std::find(SeverityNames.cbegin(), SeverityNames.cend(), token);
336  if (itr == SeverityNames.cend()) {
337  in.setstate(std::ios_base::failbit);
338  } else {
339  sev = static_cast<Severity>(itr - SeverityNames.cbegin());
340  }
341  return in;
342 }
Severity
Definition: Logger.h:73
constexpr std::array< char const *, 8 > SeverityNames
Definition: Logger.h:85
template<typename TAG >
std::string logger::replace_braces ( std::string const &  str,
TAG const  tag 
)

Definition at line 138 of file Logger.cpp.

References ChannelNames, and SeverityNames.

Referenced by make_sink().

138  {
139  constexpr std::regex::flag_type flags = std::regex::ECMAScript | std::regex::optimize;
140  static std::regex const regex(R"(\{SEVERITY\})", flags);
141  if /*constexpr*/ (std::is_same<TAG, Channel>::value) {
142  return std::regex_replace(str, regex, ChannelNames[tag]);
143  } else {
144  return std::regex_replace(str, regex, SeverityNames[tag]);
145  }
146 }
constexpr std::array< char const *, 8 > SeverityNames
Definition: Logger.h:85
constexpr std::array< char const *, 2 > ChannelNames
Definition: Logger.h:63

+ Here is the caller graph for this function:

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

Definition at line 191 of file Logger.cpp.

References get_native_process_id().

191  {
192  if /*constexpr*/ (std::is_same<TAG, Channel>::value) {
193  sink->set_formatter(
194  expr::stream << expr::format_date_time<boost::posix_time::ptime>(
195  "TimeStamp", "%Y-%m-%dT%H:%M:%S.%f")
196  << ' ' << channel << ' '
197  << boost::phoenix::bind(&get_native_process_id, process_id.or_none())
198  << ' ' << expr::smessage);
199  } else {
200  sink->set_formatter(
201  expr::stream << expr::format_date_time<boost::posix_time::ptime>(
202  "TimeStamp", "%Y-%m-%dT%H:%M:%S.%f")
203  << ' ' << severity << ' '
204  << boost::phoenix::bind(&get_native_process_id, process_id.or_none())
205  << ' ' << expr::smessage);
206  }
207 }
boost::log::attributes::current_process_id::value_type::native_type get_native_process_id(boost::log::value_ref< boost::log::attributes::current_process_id::value_type, tag::process_id > const &pid)
Definition: Logger.cpp:149

+ Here is the call graph for this function:

void logger::set_once_fatal_func ( FatalFunc  fatal_func)

Definition at line 292 of file Logger.cpp.

References g_fatal_func.

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

292  {
293  if (g_fatal_func.exchange(fatal_func)) {
294  throw std::runtime_error(
295  "logger::set_once_fatal_func() should not be called more than once.");
296  }
297 }
std::atomic< FatalFunc > g_fatal_func
Definition: Logger.cpp:244

+ Here is the caller graph for this function:

void logger::shutdown ( )

Definition at line 299 of file Logger.cpp.

Referenced by heartbeat(), anonymous_namespace{QueryRunner.cpp}::mapd_signal_handler(), startMapdServer(), and logger::LogShutdown::~LogShutdown().

299  {
300  boost::log::core::get()->remove_all_sinks();
301 }

+ Here is the caller graph for this function:

Variable Documentation

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

Definition at line 63 of file Logger.h.

Referenced by logger::LogOptions::LogOptions(), operator<<(), operator>>(), and replace_braces().

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

Definition at line 65 of file Logger.h.

Referenced by operator<<().

bool logger::g_any_active_channels {false}

Definition at line 262 of file Logger.cpp.

Referenced by fast_logging_check(), and init().

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

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

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

Severity logger::g_min_active_severity {Severity::FATAL}

Definition at line 263 of file Logger.cpp.

Referenced by fast_logging_check(), and init().

std::mutex logger::gDurationTreeMapMutex

Definition at line 475 of file Logger.cpp.

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

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

Definition at line 85 of file Logger.h.

Referenced by logger::LogOptions::LogOptions(), operator<<(), operator>>(), and replace_braces().

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

Definition at line 94 of file Logger.h.

Referenced by operator<<().