Program Listing for File Logger.h
↰ Return to documentation for file (include/gwmodelpp/Logger.h
)
#ifndef GWMLOGGER_H
#define GWMLOGGER_H
#include <vector>
#include <string>
#include <numeric>
namespace gwm
{
inline std::string strjoin(const std::string& delm, const std::vector<std::string>& str_array)
{
std::string ss = *str_array.cbegin();
for (auto it = str_array.cbegin() + 1; it != str_array.cend(); it++)
ss += (delm + *it);
return ss;
}
struct ITelegram
{
virtual ~ITelegram() {}
enum class LogLevel
{
LOG_EMERG = 0,
LOG_ALERT = 1,
LOG_CRIT = 2,
LOG_ERR = 3,
LOG_WARNING = 4,
LOG_NOTICE = 5,
LOG_INFO = 6,
LOG_DEBUG = 7
};
virtual void print(std::string message, ITelegram::LogLevel level, std::string fun_name, std::string file_name) = 0;
virtual void progress(std::size_t current, std::size_t total, std::string fun_name, std::string file_name) = 0;
virtual void progress(double percent, std::string fun_name, std::string file_name) = 0;
virtual bool stop() = 0;
};
class Logger : public ITelegram
{
public:
Logger() {}
~Logger() {}
void print(std::string message, LogLevel level, std::string fun_name, std::string file_name) override
{
(void)message;
(void)level;
(void)fun_name;
(void)file_name;
}
void progress(std::size_t current, std::size_t total, std::string fun_name, std::string file_name) override
{
(void)current;
(void)total;
(void)fun_name;
(void)file_name;
}
void progress(double percent, std::string fun_name, std::string file_name) override
{
(void)percent;
(void)fun_name;
(void)file_name;
}
bool stop() override { return false; }
};
}
#endif // GWMLOGGER_H