10 if (this->
file.is_open())
12 this->
file.open(filename.c_str(), std::ios::out | std::ios::app);
13 if (this->
file.fail()) {
14 throw std::runtime_error (
"Failed to open log file.\n");
20 this->
file << msg << std::endl;
23 std::cout << msg << std::endl;
27 void Logger::log(
const std::string type,
const std::string msg,
bool print)
34 this->
file << std::left << type <<
" -- ";
36 this->
file << msg << std::endl;
39 std::cout << this->tmpstr <<
" | ";
40 std::cout << type <<
" -- " << msg << std::endl;
46 if (this->
file.is_open())
void info(const std::string msg, bool print=false)
void log(const std::string type, const std::string msg, bool print=false)
Logger(const std::string filename)