35 lines
746 B
C++
35 lines
746 B
C++
#ifndef INCLUDE_DI_LOG_H_
|
|
#define INCLUDE_DI_LOG_H_
|
|
|
|
#include <string>
|
|
#include <cstdarg>
|
|
#include <mutex>
|
|
|
|
namespace Di {
|
|
|
|
class Log {
|
|
public:
|
|
/**
|
|
* Set loglevel
|
|
* debug, info, warning, error, critical
|
|
*/
|
|
static void setLevel(std::string level);
|
|
static void setLogfile(std::string file);
|
|
|
|
static void debug(const std::string fmt, ...);
|
|
static void info(const std::string fmt, ...);
|
|
static void warning(const std::string fmt, ...);
|
|
static void err(const std::string fmt, ...);
|
|
static void crit(const std::string fmt, ...);
|
|
|
|
private:
|
|
static void log(int level, const std::string &msg, va_list va);
|
|
static std::string logfile;
|
|
static int loglevel;
|
|
static std::mutex logLock;
|
|
};
|
|
|
|
} // namespace Di
|
|
|
|
#endif // INCLUDE_DI_LOG_H_
|