Luna/kernel/src/Log.h
apio 814672c771
All checks were successful
continuous-integration/drone/push Build is passing
Remove some redundant error propagation
Why can printing to the serial port or format onto a string fail?
Even if cstyle_format returns Result<usize>, we shouldn't always follow suit.
2022-12-16 18:32:29 +01:00

25 lines
666 B
C

#pragma once
#include <luna/Attributes.h>
#include <luna/Result.h>
#include <stdarg.h>
enum class LogLevel
{
Debug,
Info,
Warn,
Error,
};
void vlog(LogLevel level, const char* format, va_list ap);
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();
bool log_serial_enabled();
bool log_text_console_enabled();
#define kdbgln(...) log(LogLevel::Debug, __VA_ARGS__)
#define kinfoln(...) log(LogLevel::Info, __VA_ARGS__)
#define kwarnln(...) log(LogLevel::Warn, __VA_ARGS__)
#define kerrorln(...) log(LogLevel::Error, __VA_ARGS__)