Compare commits
2 Commits
985d45ddfb
...
2bc99f2e6e
Author | SHA1 | Date | |
---|---|---|---|
2bc99f2e6e | |||
3f40ccd703 |
@ -14,11 +14,17 @@ static constexpr u32 WHITE = 0xffffffff;
|
||||
static constexpr u32 YELLOW = 0xffffff00;
|
||||
static constexpr u32 RED = 0xffff0000;
|
||||
|
||||
static Result<void> log_serial(LogLevel, const char* format, va_list origin)
|
||||
static char log_level_letters[] = {'D', 'I', 'W', 'E'}; // D for debug, I for info, W for warning, E for error
|
||||
static const char* ansi_color_codes_per_log_level[] = {"37", "37", "33", "31"}; // 37 is white, 33 yellow, 31 red
|
||||
|
||||
static Result<void> log_serial(LogLevel level, const char* format, va_list origin)
|
||||
{
|
||||
va_list ap;
|
||||
va_copy(ap, origin);
|
||||
|
||||
TRY(Serial::printf("\x1b[%sm%c\x1b[0m ", ansi_color_codes_per_log_level[(int)level],
|
||||
log_level_letters[(int)level]));
|
||||
|
||||
TRY(Serial::printf("[%6zu.%.6zu] ", Timer::ticks(), Timer::ticks_us() - (Timer::ticks() * 1000000)));
|
||||
|
||||
TRY(cstyle_format(
|
||||
|
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <Attributes.h>
|
||||
#include <Result.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@ -11,7 +12,7 @@ enum class LogLevel
|
||||
};
|
||||
|
||||
Result<void> vlog(LogLevel level, const char* format, va_list ap);
|
||||
Result<void> log(LogLevel level, const char* format, ...);
|
||||
Result<void> log(LogLevel level, const char* format, ...) _format(2, 3);
|
||||
|
||||
void setup_log(bool enable_debug, bool enable_serial, bool enable_text_console);
|
||||
bool log_debug_enabled();
|
||||
|
@ -33,6 +33,10 @@ Result<void> init()
|
||||
to_dynamic_unit(MemoryManager::reserved(), buffer, sizeof(buffer));
|
||||
kinfoln("Reserved memory: %s", buffer);
|
||||
|
||||
volatile char* p = (volatile char*)0xefe0f3445692d;
|
||||
|
||||
*p = 7;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user