xerus
a general purpose tensor library
|
Header file for all logging macros and log-buffer functionality. More...
#include <mutex>
#include <string>
#include <sstream>
#include "callStack.h"
#include "exceptions.h"
#include <iostream>
Go to the source code of this file.
Classes | |
struct | xerus::misc::internal::LogFlag< lvl > |
Namespaces | |
xerus | |
The main namespace of xerus. | |
xerus::misc | |
Collection of classes and functions that provide elementary functionality that is not special to xerus as a tensor library. | |
xerus::misc::internal | |
Namespace for function and classes designated only for internal use. | |
xerus::misc::internal::buffer | |
Macros | |
#define | XERUS_COMPILE_TIME_EVAL(e) (std::integral_constant<decltype(e), e>::value) |
forces the compiler to evaluate e during compilation More... | |
#define | XERUS_IS_LOGGING(lvl) (::xerus::misc::internal::LogFlag<xerus::misc::internal::log_namehash(XERUS_STRINGIFY(lvl))>::flag != xerus::misc::internal::NOT_LOGGING) |
evaluates to true if lvl is begin logged (either to cerr or into a file on error) in the current configuration More... | |
#define | XERUS_LOG(lvl, ...) |
logs the message msg with severity level lvl More... | |
#define | XERUS_LOG_ONCE(lvl, ...) |
logs the message msg with severity level lvl at most once per program execution More... | |
#define | XERUS_LOG_SHORT(lvl, ...) |
logs the message msg with severity level lvl, omits the current file name and line number More... | |
#define | XERUS_LOGSTREAM std::cerr |
#define | XERUS_NAMED_LOGGER_LOGBUFFER(lvl) |
#define | XERUS_SET_DEFAULT_LOG_LEVELS |
#define | XERUS_SET_LOGGING(lvl, value) |
set the logging behaviour of severity level lvl to value (either NOT_LOGGING, LOGGING_ON_ERROR or LOGGING_FULL) More... | |
#define | XERUS_STRINGIFY(x) XERUS_STRINGIFY2(x) |
#define | XERUS_STRINGIFY2(x) #x |
Enumerations | |
enum | { xerus::misc::internal::NOT_LOGGING = 0, xerus::misc::internal::LOGGING_FULL = 2, xerus::misc::internal::LOGGING_EXCEPTION = 3 } |
Functions | |
void | xerus::misc::internal::buffer::checkSwitch () |
void | xerus::misc::internal::buffer::dump_log (std::string _comment) |
std::ostream & | xerus::misc::internal::get_fileStream () |
constexpr uint64_t | xerus::misc::internal::log_namehash (const char *x) |
Hashes a given c-string using the FNV-1a standard hash. More... | |
void | xerus::misc::internal::log_timestamp (std::ostream &_out, const char *_file, int _line, const char *_lvl) |
void | xerus::misc::internal::log_timestamp (std::ostream &_out, const char *_lvl) |
void | xerus::misc::internal::log_timestamp (std::ostream &_out) |
Variables | |
std::stringstream | xerus::misc::internal::buffer::current |
std::string | xerus::misc::internal::logFilePrefix |
static const auto | xerus::misc::internal::LOGGING_ON_ERROR = NOT_LOGGING |
std::mutex | xerus::misc::internal::namedLoggerMutex |
std::stringstream | xerus::misc::internal::buffer::old |
std::chrono::system_clock::time_point | xerus::misc::internal::programStartTime |
bool | xerus::misc::internal::silenced = false |
Header file for all logging macros and log-buffer functionality.
Definition in file namedLogger.h.
#define XERUS_COMPILE_TIME_EVAL | ( | e | ) | (std::integral_constant<decltype(e), e>::value) |
forces the compiler to evaluate e during compilation
Definition at line 100 of file namedLogger.h.
#define XERUS_IS_LOGGING | ( | lvl | ) | (::xerus::misc::internal::LogFlag<xerus::misc::internal::log_namehash(XERUS_STRINGIFY(lvl))>::flag != xerus::misc::internal::NOT_LOGGING) |
evaluates to true if lvl is begin logged (either to cerr or into a file on error) in the current configuration
Definition at line 198 of file namedLogger.h.
#define XERUS_LOG | ( | lvl, | |
... | |||
) |
logs the message msg with severity level lvl
the exact behaviour is modified by the SET_DEFAULT_LOG_LEVELS and XERUS_SET_LOGGING macros. In case lvl is not being logged with the current configuration, this macro evaluates to an if (false) {}
expression and is fully removed by the compiler.
Definition at line 139 of file namedLogger.h.
#define XERUS_LOG_ONCE | ( | lvl, | |
... | |||
) |
logs the message msg with severity level lvl at most once per program execution
the exact behaviour is modified by the SET_DEFAULT_LOG_LEVELS and XERUS_SET_LOGGING macros. In case lvl is not being logged with the current configuration, this macro evaluates to an if (false) {}
expression and is fully removed by the compiler.
Definition at line 185 of file namedLogger.h.
#define XERUS_LOG_SHORT | ( | lvl, | |
... | |||
) |
logs the message msg with severity level lvl, omits the current file name and line number
the exact behaviour is modified by the SET_DEFAULT_LOG_LEVELS and XERUS_SET_LOGGING macros. In case lvl is not being logged with the current configuration, this macro evaluates to an if (false) {}
expression and is fully removed by the compiler.
Definition at line 162 of file namedLogger.h.
#define XERUS_LOGSTREAM std::cerr |
Definition at line 39 of file namedLogger.h.
#define XERUS_NAMED_LOGGER_LOGBUFFER | ( | lvl | ) |
Definition at line 127 of file namedLogger.h.
#define XERUS_SET_DEFAULT_LOG_LEVELS |
Definition at line 219 of file namedLogger.h.
#define XERUS_SET_LOGGING | ( | lvl, | |
value | |||
) |
set the logging behaviour of severity level lvl to value (either NOT_LOGGING, LOGGING_ON_ERROR or LOGGING_FULL)
this definition must not be repeated and must be defined in a global header that is included before any msg is logged with that lvl
Definition at line 211 of file namedLogger.h.
#define XERUS_STRINGIFY | ( | x | ) | XERUS_STRINGIFY2(x) |
Definition at line 93 of file namedLogger.h.
#define XERUS_STRINGIFY2 | ( | x | ) | #x |
Definition at line 92 of file namedLogger.h.