27 : _client_data(nullptr) {
28 H5Eget_auto2(H5E_DEFAULT, &_func, &_client_data);
30 H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
34 H5Eset_auto2(H5E_DEFAULT, _func, _client_data);
42#define HIGHFIVE_LOG_LEVEL_DEBUG 10
43#define HIGHFIVE_LOG_LEVEL_INFO 20
44#define HIGHFIVE_LOG_LEVEL_WARN 30
45#define HIGHFIVE_LOG_LEVEL_ERROR 40
47#ifndef HIGHFIVE_LOG_LEVEL
48#define HIGHFIVE_LOG_LEVEL HIGHFIVE_LOG_LEVEL_WARN
90 std::function<void(
LogSeverity,
const std::string&,
const std::string&,
int)>;
98 : _cb(std::move(cb)) {}
104 const std::string& message,
105 const std::string& file,
107 _cb(severity, message, file, line);
119 const std::string& message,
120 const std::string& file,
122 std::clog << file <<
": " << line <<
" :: " <<
to_string(severity) << message << std::endl;
140 logger.set_logging_callback(std::move(cb));
146 const std::string& message,
147 const std::string& file,
150 logger.log(severity, message, file, line);
154#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_DEBUG
155#define HIGHFIVE_LOG_DEBUG(message) \
156 ::HighFive::detail::log(::HighFive::LogSeverity::Debug, (message), __FILE__, __LINE__);
159#define HIGHFIVE_LOG_DEBUG_IF(cond, message) \
161 HIGHFIVE_LOG_DEBUG((message)); \
165#define HIGHFIVE_LOG_DEBUG(message) ;
166#define HIGHFIVE_LOG_DEBUG_IF(cond, message) ;
169#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_INFO
170#define HIGHFIVE_LOG_INFO(message) \
171 ::HighFive::detail::log(::HighFive::LogSeverity::Info, (message), __FILE__, __LINE__);
174#define HIGHFIVE_LOG_INFO_IF(cond, message) \
176 HIGHFIVE_LOG_INFO((message)); \
180#define HIGHFIVE_LOG_INFO(message) ;
181#define HIGHFIVE_LOG_INFO_IF(cond, message) ;
185#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_WARN
186#define HIGHFIVE_LOG_WARN(message) \
187 ::HighFive::detail::log(::HighFive::LogSeverity::Warn, (message), __FILE__, __LINE__);
190#define HIGHFIVE_LOG_WARN_IF(cond, message) \
192 HIGHFIVE_LOG_WARN((message)); \
196#define HIGHFIVE_LOG_WARN(message) ;
197#define HIGHFIVE_LOG_WARN_IF(cond, message) ;
200#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_ERROR
201#define HIGHFIVE_LOG_ERROR(message) \
202 ::HighFive::detail::log(::HighFive::LogSeverity::Error, (message), __FILE__, __LINE__);
205#define HIGHFIVE_LOG_ERROR_IF(cond, message) \
207 HIGHFIVE_LOG_ERROR((message)); \
211#define HIGHFIVE_LOG_ERROR(message) ;
212#define HIGHFIVE_LOG_ERROR_IF(cond, message) ;
#define HIGHFIVE_LOG_LEVEL_WARN
Definition H5Utility.hpp:44
#define HIGHFIVE_LOG_LEVEL_ERROR
Definition H5Utility.hpp:45
#define HIGHFIVE_LOG_LEVEL_DEBUG
Definition H5Utility.hpp:42
#define HIGHFIVE_LOG_LEVEL_INFO
Definition H5Utility.hpp:43
A logger with supporting basic functionality.
Definition H5Utility.hpp:87
Logger(const Logger &)=delete
Logger & operator=(const Logger &)=delete
std::function< void(LogSeverity, const std::string &, const std::string &, int)> callback_type
Definition H5Utility.hpp:90
void set_logging_callback(callback_type cb)
Definition H5Utility.hpp:110
Logger(callback_type cb)
Definition H5Utility.hpp:97
Logger & operator=(Logger &&)=delete
void log(LogSeverity severity, const std::string &message, const std::string &file, int line)
Definition H5Utility.hpp:103
Utility class to disable HDF5 stack printing inside a scope.
Definition H5Utility.hpp:24
~SilenceHDF5()
Definition H5Utility.hpp:33
SilenceHDF5(bool enable=true)
Definition H5Utility.hpp:26
Definition H5_definitions.hpp:15
void register_logging_callback(Logger::callback_type cb)
Sets the callback that's used by the logger.
Definition H5Utility.hpp:138
LogSeverity
Definition H5Utility.hpp:51
void default_logging_callback(LogSeverity severity, const std::string &message, const std::string &file, int line)
Definition H5Utility.hpp:118
std::string to_string(LogSeverity severity)
Definition H5Utility.hpp:58
Logger & get_global_logger()
Obtain a reference to the logger used by HighFive.
Definition H5Utility.hpp:132