From 9afaad8fedfa05989be0a1a76e1d3fb2e4b10820 Mon Sep 17 00:00:00 2001 From: apio Date: Thu, 22 Dec 2022 18:00:35 +0100 Subject: [PATCH] Add dbgln() for the luna library --- kernel/src/Log.cpp | 6 ++++++ luna/CMakeLists.txt | 1 + luna/include/luna/DebugLog.h | 7 +++++++ luna/src/DebugLog.cpp | 9 +++++++++ 4 files changed, 23 insertions(+) create mode 100644 luna/include/luna/DebugLog.h create mode 100644 luna/src/DebugLog.cpp diff --git a/kernel/src/Log.cpp b/kernel/src/Log.cpp index ae3db02e..d8194fd1 100644 --- a/kernel/src/Log.cpp +++ b/kernel/src/Log.cpp @@ -87,6 +87,12 @@ void log(LogLevel level, const char* format, ...) va_end(ap); } +// for luna/DebugLog.h +void debug_log_impl(const char* format, va_list ap) +{ + vlog(LogLevel::Debug, format, ap); +} + void setup_log(bool enable_debug, bool enable_serial, bool enable_text_console) { g_debug_enabled = enable_debug; diff --git a/luna/CMakeLists.txt b/luna/CMakeLists.txt index 54b55b97..7583fc4b 100644 --- a/luna/CMakeLists.txt +++ b/luna/CMakeLists.txt @@ -12,6 +12,7 @@ set(FREESTANDING_SOURCES src/OwnedStringView.cpp src/Utf8.cpp src/TarStream.cpp + src/DebugLog.cpp ) set(SOURCES diff --git a/luna/include/luna/DebugLog.h b/luna/include/luna/DebugLog.h new file mode 100644 index 00000000..5a32a7a4 --- /dev/null +++ b/luna/include/luna/DebugLog.h @@ -0,0 +1,7 @@ +#pragma once +#include +#include + +extern void debug_log_impl(const char* format, va_list ap); + +void dbgln(const char* format, ...) _format(1, 2); \ No newline at end of file diff --git a/luna/src/DebugLog.cpp b/luna/src/DebugLog.cpp new file mode 100644 index 00000000..b2639723 --- /dev/null +++ b/luna/src/DebugLog.cpp @@ -0,0 +1,9 @@ +#include + +void dbgln(const char* format, ...) +{ + va_list ap; + va_start(ap, format); + debug_log_impl(format, ap); + va_end(ap); +} \ No newline at end of file