Skip to content
Permalink
36f9d80687
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
51 lines (38 sloc) 864 Bytes
#ifndef LOGGER_H
#define LOGGER_H
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
extern class Logger {
public:
int logging_Level = 1;
string filename = "log.txt";
};
void start_log(string filename){
ofstream log_file;
log_file.open(filename, std::ios_base::in | std::ios_base::trunc);
log_file << "Start log";
log_file.close();
}
void write_log(string msg, int msg_level, string filename, Logger* logObject) {
string line;
ofstream log_file;
log_file.open(filename, std::ios_base::app);
if (logObject->logging_Level <= msg_level) {
//for (int i = 0; i < &msg.size; i++)
log_file << msg;
}
log_file.close();
}
Logger* logger = NULL;
Logger* getLogger() {
if (logger == NULL) {
logger = new Logger();
}
return logger;
}
//Logger* logger = getLogger();
#endif