generated from zhangwei/Train_Identify
48 lines
937 B
C++
48 lines
937 B
C++
#ifndef MYLOG_H_
|
|
#define MYLOG_H_
|
|
|
|
#include <assert.h>
|
|
#include <unistd.h>
|
|
#include <string>
|
|
#include <map>
|
|
#include <fstream>
|
|
#include <iomanip>
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include <vector>
|
|
#include <sys/time.h>
|
|
|
|
namespace ai_matrix
|
|
{
|
|
class MyLog final
|
|
{
|
|
public:
|
|
MyLog() = default;
|
|
MyLog(const MyLog &) = delete;
|
|
MyLog(MyLog &&) = delete;
|
|
MyLog &operator=(const MyLog &) = delete;
|
|
MyLog &operator=(MyLog &&) = delete;
|
|
~MyLog();
|
|
|
|
//获取日志文件名
|
|
std::string get_name() const;
|
|
|
|
//创建日志文件
|
|
void open_file(std::string filename);
|
|
|
|
//关闭日志文件
|
|
void close();
|
|
|
|
//判断日志文件是否打开
|
|
bool is_open();
|
|
|
|
//写入日志文件
|
|
void write(std::string value);
|
|
|
|
private:
|
|
std::ofstream of_;
|
|
std::string name_; //日志文件名
|
|
};
|
|
}
|
|
|
|
#endif |