Throw string

testing
marcelb 1 year ago
parent b234320e18
commit 8fcddba591
  1. 10
      src/log.cpp

@ -1,12 +1,12 @@
#include "../lib/log.hpp" #include "../lib/log.hpp"
log::log(string _dir, bool _isKeepOpen, bool _printInConsole = false) { log::log(string _dir, bool _isKeepOpen, bool _printInConsole) {
dir = _dir; dir = _dir;
isKeepOpen = _isKeepOpen; isKeepOpen = _isKeepOpen;
printInConsole = _printInConsole; printInConsole = _printInConsole;
if (!isdir()) { if (!isdir()) {
throw "[ERROR] Log dir path invalid "; throw string("[ERROR] Log dir path invalid ");
} }
setMoment(); setMoment();
@ -15,7 +15,7 @@ log::log(string _dir, bool _isKeepOpen, bool _printInConsole = false) {
if (isKeepOpen) { if (isKeepOpen) {
if (!open()) { if (!open()) {
throw "[ERROR] Opening log file! "; throw string("[ERROR] Opening log file! ");
} }
} }
@ -58,14 +58,14 @@ void log::put(string logline) {
setPath(); setPath();
if (isKeepOpen) { if (isKeepOpen) {
if (!open()) { if (!open()) {
throw "[ERROR] Opening log file! "; throw string("[ERROR] Opening log file! ");
} }
} }
} }
if (!isKeepOpen || !logfile.is_open()) { if (!isKeepOpen || !logfile.is_open()) {
if (!open()) { if (!open()) {
throw "[ERROR] Opening log file! "; throw string("[ERROR] Opening log file! ");
} }
} }

Loading…
Cancel
Save