libcryfs/logging/logging.h

59 lines
1.4 KiB
C
Raw Normal View History

2015-10-17 03:08:56 +02:00
#pragma once
#ifndef MESSMER_CPPUTILS_LOGGING_LOGGING_H
#define MESSMER_CPPUTILS_LOGGING_LOGGING_H
#include "Logger.h"
#include <stdexcept>
namespace cpputils {
namespace logging {
extern struct ERROR_TYPE {} ERROR;
extern struct WARN_TYPE {} WARN;
extern struct INFO_TYPE {} INFO;
extern struct DEBUG_TYPE {} DEBUG;
2015-10-17 03:08:56 +02:00
inline void setLogger(std::shared_ptr<spdlog::logger> newLogger) {
logger().setLogger(newLogger);
}
2015-10-17 15:49:54 +02:00
inline void reset() {
logger().reset();
}
inline void setLevel(ERROR_TYPE) {
logger().setLevel(spdlog::level::err);
}
inline void setLevel(WARN_TYPE) {
logger().setLevel(spdlog::level::warn);
}
inline void setLevel(INFO_TYPE) {
logger().setLevel(spdlog::level::info);
}
inline void setLevel(DEBUG_TYPE) {
logger().setLevel(spdlog::level::debug);
}
inline spdlog::details::line_logger LOG(ERROR_TYPE) {
return logger()->error();
}
inline spdlog::details::line_logger LOG(WARN_TYPE) {
return logger()->warn();
}
inline spdlog::details::line_logger LOG(INFO_TYPE) {
return logger()->info();
}
inline spdlog::details::line_logger LOG(DEBUG_TYPE) {
return logger()->debug();
2015-10-17 03:08:56 +02:00
}
}
}
#endif