27 : _client_data(nullptr) {
28 detail::nothrow::h5e_get_auto2(H5E_DEFAULT, &_func, &_client_data);
31 detail::nothrow::h5e_set_auto2(H5E_DEFAULT,
nullptr,
nullptr);
36 detail::nothrow::h5e_set_auto2(H5E_DEFAULT, _func, _client_data);
44#define HIGHFIVE_LOG_LEVEL_DEBUG 10
45#define HIGHFIVE_LOG_LEVEL_INFO 20
46#define HIGHFIVE_LOG_LEVEL_WARN 30
47#define HIGHFIVE_LOG_LEVEL_ERROR 40
49#ifndef HIGHFIVE_LOG_LEVEL
50#define HIGHFIVE_LOG_LEVEL HIGHFIVE_LOG_LEVEL_WARN
92 std::function<void(
LogSeverity,
const std::string&,
const std::string&,
int)>;
100 : _cb(std::move(cb)) {}
106 const std::string& message,
107 const std::string& file,
109 _cb(severity, message, file, line);
121 const std::string& message,
122 const std::string& file,
124 std::clog << file <<
": " << line <<
" [" <<
to_string(severity) <<
"] " << message
143 logger.set_logging_callback(std::move(cb));
149 const std::string& message,
150 const std::string& file,
153 logger.log(severity, message, file, line);
157#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_DEBUG
158#define HIGHFIVE_LOG_DEBUG(message) \
159 ::HighFive::detail::log(::HighFive::LogSeverity::Debug, (message), __FILE__, __LINE__);
162#define HIGHFIVE_LOG_DEBUG_IF(cond, message) \
164 HIGHFIVE_LOG_DEBUG((message)); \
168#define HIGHFIVE_LOG_DEBUG(message) ;
169#define HIGHFIVE_LOG_DEBUG_IF(cond, message) ;
172#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_INFO
173#define HIGHFIVE_LOG_INFO(message) \
174 ::HighFive::detail::log(::HighFive::LogSeverity::Info, (message), __FILE__, __LINE__);
177#define HIGHFIVE_LOG_INFO_IF(cond, message) \
179 HIGHFIVE_LOG_INFO((message)); \
183#define HIGHFIVE_LOG_INFO(message) ;
184#define HIGHFIVE_LOG_INFO_IF(cond, message) ;
188#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_WARN
189#define HIGHFIVE_LOG_WARN(message) \
190 ::HighFive::detail::log(::HighFive::LogSeverity::Warn, (message), __FILE__, __LINE__);
193#define HIGHFIVE_LOG_WARN_IF(cond, message) \
195 HIGHFIVE_LOG_WARN((message)); \
199#define HIGHFIVE_LOG_WARN(message) ;
200#define HIGHFIVE_LOG_WARN_IF(cond, message) ;
203#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_ERROR
204#define HIGHFIVE_LOG_ERROR(message) \
205 ::HighFive::detail::log(::HighFive::LogSeverity::Error, (message), __FILE__, __LINE__);
208#define HIGHFIVE_LOG_ERROR_IF(cond, message) \
210 HIGHFIVE_LOG_ERROR((message)); \
214#define HIGHFIVE_LOG_ERROR(message) ;
215#define HIGHFIVE_LOG_ERROR_IF(cond, message) ;
#define HIGHFIVE_LOG_LEVEL_WARN
Definition H5Utility.hpp:46
#define HIGHFIVE_LOG_LEVEL_ERROR
Definition H5Utility.hpp:47
#define HIGHFIVE_LOG_LEVEL_DEBUG
Definition H5Utility.hpp:44
#define HIGHFIVE_LOG_LEVEL_INFO
Definition H5Utility.hpp:45
A logger with supporting basic functionality.
Definition H5Utility.hpp:89
Logger(const Logger &)=delete
std::function< void(LogSeverity, const std::string &, const std::string &, int)> callback_type
Definition H5Utility.hpp:91
Logger & operator=(const Logger &)=delete
void set_logging_callback(callback_type cb)
Definition H5Utility.hpp:112
Logger(callback_type cb)
Definition H5Utility.hpp:99
Logger & operator=(Logger &&)=delete
void log(LogSeverity severity, const std::string &message, const std::string &file, int line)
Definition H5Utility.hpp:105
Utility class to disable HDF5 stack printing inside a scope.
Definition H5Utility.hpp:24
~SilenceHDF5()
Definition H5Utility.hpp:35
SilenceHDF5(bool enable=true)
Definition H5Utility.hpp:26
Definition H5_definitions.hpp:22
void register_logging_callback(Logger::callback_type cb)
Sets the callback that's used by the logger.
Definition H5Utility.hpp:141
LogSeverity
Definition H5Utility.hpp:53
void default_logging_callback(LogSeverity severity, const std::string &message, const std::string &file, int line)
Definition H5Utility.hpp:120
std::string to_string(LogSeverity severity)
Definition H5Utility.hpp:60
Logger & get_global_logger()
Obtain a reference to the logger used by HighFive.
Definition H5Utility.hpp:135