mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
Move kernel over to new logger
This commit is contained in:
@@ -1,52 +1,16 @@
|
||||
#pragma once
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
class console;
|
||||
#include "kutil/logger.h"
|
||||
|
||||
namespace log = kutil::log;
|
||||
|
||||
enum class logs
|
||||
{
|
||||
boot,
|
||||
memory,
|
||||
apic,
|
||||
device,
|
||||
driver,
|
||||
fs,
|
||||
task,
|
||||
paging,
|
||||
namespace logs {
|
||||
|
||||
max
|
||||
};
|
||||
#define LOG(name, lvl) extern log::area_t name;
|
||||
#include "log_areas.inc"
|
||||
#undef LOG
|
||||
|
||||
void init();
|
||||
|
||||
class log
|
||||
{
|
||||
public:
|
||||
enum class level {debug, info, warn, error, fatal, max};
|
||||
} // namespace logs
|
||||
|
||||
static void init(console *cons);
|
||||
static void enable(logs type, level at_level);
|
||||
|
||||
template <level L>
|
||||
static void trylog(logs area, const char *fmt, ...);
|
||||
using trylog_p = void (*)(logs area, const char *fmt, ...);
|
||||
|
||||
static const trylog_p debug;
|
||||
static const trylog_p info;
|
||||
static const trylog_p warn;
|
||||
static const trylog_p error;
|
||||
static const trylog_p fatal;
|
||||
|
||||
private:
|
||||
void output(level severity, logs area, const char *fmt, va_list args);
|
||||
|
||||
/// Bitmasks for what categories are enabled. fatal is
|
||||
/// always enabled, so leave it out.
|
||||
uint64_t m_enabled[static_cast<uint64_t>(level::max) - 1];
|
||||
console *m_cons;
|
||||
|
||||
log();
|
||||
log(console *cons);
|
||||
static log s_log;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user