D
David
Hello,
I want to write a simple logging class. But when I instantiate the
logger with
Logger::logger log("log.log");
I get a "Bus Error - core dumped". Can anybody help?
Thanks beforehand,
David
This is my logger.hpp file (I tried it with .h, too.)
#define TRACE 0
#define DEBUG 1
#define INFO 2
#define WARN 3
#define FATAL 4
namespace Logger {
class logger {
public:
logger(char* logfile);
void setLevel(int level);
void trace(char* msg);
void debug(char* msg);
void info(char* msg);
void warn(char* msg);
void fatal(char* msg);
};
}
This is my logger.cc File
#include "logger.hpp"
#include <fstream>
//using namespace std;
namespace Logger {
//char* logfile;
//int level = INFO;
logger::logger(char* file) {
/*
logfile = file;
std:fstream out;
out.open(logfile, ios_base::app);
//out << "**********************************************************\n";
out.close();
*/
}
void logger::setLevel(int logLevel) {
//level = logLevel;
}
void logger::trace(char* msg) {
}
void logger::debug(char* msg) {
}
void logger::info(char* msg) {
}
void logger::warn(char* msg) {
}
void logger::fatal(char* msg) {
}
}
I want to write a simple logging class. But when I instantiate the
logger with
Logger::logger log("log.log");
I get a "Bus Error - core dumped". Can anybody help?
Thanks beforehand,
David
This is my logger.hpp file (I tried it with .h, too.)
#define TRACE 0
#define DEBUG 1
#define INFO 2
#define WARN 3
#define FATAL 4
namespace Logger {
class logger {
public:
logger(char* logfile);
void setLevel(int level);
void trace(char* msg);
void debug(char* msg);
void info(char* msg);
void warn(char* msg);
void fatal(char* msg);
};
}
This is my logger.cc File
#include "logger.hpp"
#include <fstream>
//using namespace std;
namespace Logger {
//char* logfile;
//int level = INFO;
logger::logger(char* file) {
/*
logfile = file;
std:fstream out;
out.open(logfile, ios_base::app);
//out << "**********************************************************\n";
out.close();
*/
}
void logger::setLevel(int logLevel) {
//level = logLevel;
}
void logger::trace(char* msg) {
}
void logger::debug(char* msg) {
}
void logger::info(char* msg) {
}
void logger::warn(char* msg) {
}
void logger::fatal(char* msg) {
}
}