12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #pragma once
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <mutex>
- using namespace std;
- namespace graft_cv{
- class CGcvLogger{
- public:
- enum log_level{debug,info, warning,error};
- enum log_target{file,terminal,file_and_terminal};
- private:
- ofstream& m_outfile;
- log_target m_target;
- string m_path;
- log_level m_level;
- std::shared_ptr<std::mutex> m_pMtx;
- void output(string text, log_level act_level);
- public:
- CGcvLogger(ofstream&);
- CGcvLogger(ofstream&,
- log_target target,
- log_level level,
- string path);
- void setPath(const string& path);
- string & getPath();
- void setLevel(log_level lev){
- m_level = lev;
- };
- int getLevel(){return m_level;};
- void DEBUG(string text);
- void INFO(string text);
- void WARNING(string text);
- void ERRORINFO(string text);
-
- };
- };
|