logging
This commit is contained in:
@ -13,7 +13,7 @@ private:
|
||||
|
||||
public:
|
||||
MainMenu() : listener(*this) {
|
||||
kout << "MainMenu initialized" << endl;
|
||||
log << INFO << "MainMenu initialized with ID: " << dec << this->tid << endl;
|
||||
// kevman.subscribe(this->listener);
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ private:
|
||||
|
||||
public:
|
||||
KeyboardDemo() : listener(*this) {
|
||||
kout << "Initialized KeyboardDemo" << endl;
|
||||
log << INFO << "Initialized KeyboardDemo with ID: " << dec << this->tid << endl;
|
||||
kevman.subscribe(this->listener);
|
||||
}
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#include "user/lib/Logger.h"
|
||||
#include "kernel/Globals.h"
|
||||
|
||||
bool Logger::kout_enabled = false;
|
||||
bool Logger::kout_enabled = true;
|
||||
bool Logger::serial_enabled = true;
|
||||
const Semaphore Logger::sem = Semaphore(1);
|
||||
// const Semaphore Logger::sem = Semaphore(1);
|
||||
|
||||
Logger::LogLevel Logger::level = Logger::TRACE;
|
||||
Logger::LogLevel Logger::level = Logger::ERROR;
|
||||
|
||||
void Logger::log(char* message, CGA::color col) const {
|
||||
if (Logger::kout_enabled) {
|
||||
@ -68,7 +68,7 @@ void Logger::error(char* message) const {
|
||||
}
|
||||
|
||||
void Logger::info(char* message) const {
|
||||
if (Logger::level <= Logger::TRACE) {
|
||||
if (Logger::level <= Logger::INFO) {
|
||||
this->log(message, CGA::CYAN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include "devices/CGA.h"
|
||||
#include "lib/OutStream.h"
|
||||
#include "lib/Semaphore.h"
|
||||
// #include "lib/Semaphore.h"
|
||||
|
||||
class Logger : public OutStream {
|
||||
private:
|
||||
@ -14,7 +14,7 @@ private:
|
||||
static bool serial_enabled;
|
||||
|
||||
// TODO: Don't mix logs
|
||||
static const Semaphore sem;
|
||||
// static const Semaphore sem;
|
||||
|
||||
void log(char* message, CGA::color col) const;
|
||||
|
||||
@ -22,10 +22,10 @@ public:
|
||||
Logger(char* name) : name(name) {}
|
||||
|
||||
enum LogLevel {
|
||||
TRACE = 0,
|
||||
DEBUG = 1,
|
||||
ERROR = 2,
|
||||
INFO = 3
|
||||
TRACE,
|
||||
DEBUG,
|
||||
ERROR,
|
||||
INFO
|
||||
};
|
||||
static LogLevel level;
|
||||
LogLevel current_message_level = Logger::INFO; // Use this to log with manipulators
|
||||
|
||||
Reference in New Issue
Block a user