#pragma once enum class LogLevel { INFO, WARN, ERROR }; #define PRINTF_LIKE(n, m) __attribute__((format(printf, n, m))) namespace KernelLog { void log(const char* function, LogLevel level, const char* message, ...) PRINTF_LIKE(3, 4); void logln(const char* function, LogLevel level, const char* message, ...) PRINTF_LIKE(3, 4); } #ifndef MODULE #define kcommonlog(function, level, ...) KernelLog::function(__FUNCTION__, level, __VA_ARGS__) #else #define kcommonlog(function, level, ...) KernelLog::function(MODULE, level, __VA_ARGS__) #endif #define kinfo(...) kcommonlog(log, LogLevel::INFO, __VA_ARGS__) #define kinfoln(...) kcommonlog(logln, LogLevel::INFO, __VA_ARGS__) #define kwarn(...) kcommonlog(log, LogLevel::WARN, __VA_ARGS__) #define kwarnln(...) kcommonlog(logln, LogLevel::WARN, __VA_ARGS__) #define kerror(...) kcommonlog(log, LogLevel::ERROR, __VA_ARGS__) #define kerrorln(...) kcommonlog(logln, LogLevel::ERROR, __VA_ARGS__)