mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Add temporary log output
Currently the kernel idle process is an infinite loop printing logs, with no locking.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "kutil/constexpr_hash.h"
|
||||
#include "kutil/memory.h"
|
||||
#include "console.h"
|
||||
#include "log.h"
|
||||
|
||||
namespace logs {
|
||||
@@ -13,6 +14,33 @@ static log::logger g_logger(log_buffer, sizeof(log_buffer));
|
||||
#include "log_areas.inc"
|
||||
#undef LOG
|
||||
|
||||
static const uint8_t level_colors[] = {0x07, 0x07, 0x0f, 0x0b, 0x09};
|
||||
|
||||
static void
|
||||
output_log(log::level severity, log::area_t area, const char *message)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
output_logs()
|
||||
{
|
||||
uint8_t buffer[257];
|
||||
auto *ent = reinterpret_cast<log::logger::entry *>(buffer);
|
||||
auto *cons = console::get();
|
||||
|
||||
while (true) {
|
||||
if(g_logger.get_entry(buffer, sizeof(buffer))) {
|
||||
buffer[ent->bytes] = 0;
|
||||
cons->set_color(level_colors[static_cast<int>(ent->severity)]);
|
||||
cons->printf("%9s %8s: %s\n",
|
||||
g_logger.area_name(ent->area),
|
||||
g_logger.level_name(ent->severity),
|
||||
ent->message);
|
||||
cons->set_color();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
new (&g_logger) log::logger(log_buffer, sizeof(log_buffer));
|
||||
|
||||
Reference in New Issue
Block a user