Completed logging class to rudementary level. Extra operator overloadings still needed
This commit is contained in:
1 parent
7fa4d1fc58
commit
0dfda6f481
6 files changed
+87
-60
No files matched your search
@@ -2,13 +2,15 @@
|
||||
#define LOGGER_HPP
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include "Core.hpp"
|
||||
#include <ostream>
|
||||
#include "EventBus.hpp"
|
||||
|
||||
namespace Plains {
|
||||
namespace Core {
|
||||
|
||||
using std::string;
|
||||
using std::ofstream;
|
||||
using std::ostream;
|
||||
using std::streambuf;
|
||||
|
||||
class Logger {
|
||||
@@ -19,14 +21,23 @@ class Logger {
|
||||
void setLogLevel(Level level);
|
||||
void log(Level lvl, const char* msg);
|
||||
void log(Level lvl, const string& msg);
|
||||
void debug(const string& msg);
|
||||
void debug(const char* msg);
|
||||
void info(const string& msg);
|
||||
void info(const char* msg);
|
||||
void warn(const string& msg);
|
||||
void warn(const char* msg);
|
||||
void fatal(const string& msg);
|
||||
void fatal(const char* msg);
|
||||
|
||||
class Sink {
|
||||
private:
|
||||
Logger& parent;
|
||||
const Logger::Level level;
|
||||
public:
|
||||
Sink(const Level level, Logger& parent);
|
||||
void ln (const string& msg);
|
||||
void ln (const char* msg);
|
||||
Sink& operator<<(const string& msg);
|
||||
Sink& operator<<(const char* msg);
|
||||
};
|
||||
|
||||
Sink debug;
|
||||
Sink info;
|
||||
Sink warn;
|
||||
Sink fatal;
|
||||
|
||||
private:
|
||||
EventBus& eventBus;
|
||||
@@ -37,5 +48,6 @@ class Logger {
|
||||
|
||||
|
||||
|
||||
|
||||
}}
|
||||
#endif
|
||||
Reference in new issue
Block a user