41 lines
889 B
C++
41 lines
889 B
C++
#ifndef LOG_H
|
|
#define LOG_H
|
|
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <filesystem>
|
|
|
|
class Log {
|
|
std::ostream log_file;
|
|
std::fstream log_file_s;
|
|
public:
|
|
explicit Log(std::string file_name, int max_size);
|
|
explicit Log(int *other);
|
|
~Log();
|
|
Log(const Log &other);
|
|
void copyFromOther(const Log &other);
|
|
bool isOpen();
|
|
std::ostream& rdbuf();
|
|
Log& operator<<(std::filesystem::path p);
|
|
Log& operator<<(std::ostream&(*f)(std::ostream&));
|
|
template<typename T>
|
|
Log &operator<<(T t) {
|
|
log_file << t;
|
|
std::cout << t;
|
|
return *this;
|
|
}
|
|
template<typename T>
|
|
Log &operator<<(const T *t) {
|
|
log_file << t;
|
|
std::cout << t;
|
|
return *this;
|
|
}
|
|
template<typename T>
|
|
Log &operator<<(T *t) {
|
|
log_file << t;
|
|
std::cout << t;
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
#endif // LOG_H
|