1
This commit is contained in:
2022-07-16 16:38:48 +02:00
parent 019e092a5e
commit 83b84e238b
4 changed files with 12 additions and 12 deletions

View File

@ -13,7 +13,7 @@ private:
public: public:
MainMenu() : listener(*this) { MainMenu() : listener(*this) {
kout << "MainMenu initialized" << endl; log << INFO << "MainMenu initialized with ID: " << dec << this->tid << endl;
// kevman.subscribe(this->listener); // kevman.subscribe(this->listener);
} }

View File

@ -23,7 +23,7 @@ private:
public: public:
KeyboardDemo() : listener(*this) { KeyboardDemo() : listener(*this) {
kout << "Initialized KeyboardDemo" << endl; log << INFO << "Initialized KeyboardDemo with ID: " << dec << this->tid << endl;
kevman.subscribe(this->listener); kevman.subscribe(this->listener);
} }

View File

@ -1,11 +1,11 @@
#include "user/lib/Logger.h" #include "user/lib/Logger.h"
#include "kernel/Globals.h" #include "kernel/Globals.h"
bool Logger::kout_enabled = false; bool Logger::kout_enabled = true;
bool Logger::serial_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 { void Logger::log(char* message, CGA::color col) const {
if (Logger::kout_enabled) { if (Logger::kout_enabled) {
@ -68,7 +68,7 @@ void Logger::error(char* message) const {
} }
void Logger::info(char* message) const { void Logger::info(char* message) const {
if (Logger::level <= Logger::TRACE) { if (Logger::level <= Logger::INFO) {
this->log(message, CGA::CYAN); this->log(message, CGA::CYAN);
} }
} }

View File

@ -3,7 +3,7 @@
#include "devices/CGA.h" #include "devices/CGA.h"
#include "lib/OutStream.h" #include "lib/OutStream.h"
#include "lib/Semaphore.h" // #include "lib/Semaphore.h"
class Logger : public OutStream { class Logger : public OutStream {
private: private:
@ -14,7 +14,7 @@ private:
static bool serial_enabled; static bool serial_enabled;
// TODO: Don't mix logs // TODO: Don't mix logs
static const Semaphore sem; // static const Semaphore sem;
void log(char* message, CGA::color col) const; void log(char* message, CGA::color col) const;
@ -22,10 +22,10 @@ public:
Logger(char* name) : name(name) {} Logger(char* name) : name(name) {}
enum LogLevel { enum LogLevel {
TRACE = 0, TRACE,
DEBUG = 1, DEBUG,
ERROR = 2, ERROR,
INFO = 3 INFO
}; };
static LogLevel level; static LogLevel level;
LogLevel current_message_level = Logger::INFO; // Use this to log with manipulators LogLevel current_message_level = Logger::INFO; // Use this to log with manipulators