From cf9653646889f064d34e6428115d90fe7b8a4642 Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 23 Jan 2023 10:15:37 -0500 Subject: [PATCH] Logging begin --- .../CMakeFiles/clion-Release-log.txt | 2 +- cmake-build-release/build.ninja | 9 ++++- include/blt/std/logging.h | 21 ++++++++++ src/blt/std/logging.cpp | 40 +++++++++++++++++++ 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 include/blt/std/logging.h create mode 100644 src/blt/std/logging.cpp diff --git a/cmake-build-release/CMakeFiles/clion-Release-log.txt b/cmake-build-release/CMakeFiles/clion-Release-log.txt index 013c5ba..867b415 100644 --- a/cmake-build-release/CMakeFiles/clion-Release-log.txt +++ b/cmake-build-release/CMakeFiles/clion-Release-log.txt @@ -1,6 +1,6 @@ /opt/netbrains/clion/clion-2022.1.3/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/opt/netbrains/clion/clion-2022.1.3/bin/ninja/linux/ninja -DBUILD_TESTS:BOOL=ON -G Ninja -S /home/brett/Documents/code/c++/BLT -B /home/brett/Documents/code/c++/BLT/cmake-build-release -- Detected PHMAP Version - 1.3.8 -Standard Files /home/brett/Documents/code/c++/BLT/src/blt/std/queues.cpp;/home/brett/Documents/code/c++/BLT/src/blt/std/random.cpp;/home/brett/Documents/code/c++/BLT/src/blt/std/string.cpp;/home/brett/Documents/code/c++/BLT/src/blt/std/system.cpp +Standard Files /home/brett/Documents/code/c++/BLT/src/blt/std/logging.cpp;/home/brett/Documents/code/c++/BLT/src/blt/std/queues.cpp;/home/brett/Documents/code/c++/BLT/src/blt/std/random.cpp;/home/brett/Documents/code/c++/BLT/src/blt/std/string.cpp;/home/brett/Documents/code/c++/BLT/src/blt/std/system.cpp Profiler Files /home/brett/Documents/code/c++/BLT/src/blt/profiling/profiler.cpp Source: /home/brett/Documents/code/c++/BLT Current Source: /home/brett/Documents/code/c++/BLT diff --git a/cmake-build-release/build.ninja b/cmake-build-release/build.ninja index 1509a7c..a04a168 100644 --- a/cmake-build-release/build.ninja +++ b/cmake-build-release/build.ninja @@ -49,6 +49,13 @@ cmake_ninja_workdir = /home/brett/Documents/code/c++/BLT/cmake-build-release/ build cmake_object_order_depends_target_BLT: phony || CMakeFiles/BLT.dir +build CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o: CXX_COMPILER__BLT_Release /home/brett/Documents/code/c++/BLT/src/blt/std/logging.cpp || cmake_object_order_depends_target_BLT + DEP_FILE = CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o.d + FLAGS = -O3 -DNDEBUG -fdiagnostics-color=always + INCLUDES = -I/home/brett/Documents/code/c++/BLT/include + OBJECT_DIR = CMakeFiles/BLT.dir + OBJECT_FILE_DIR = CMakeFiles/BLT.dir/src/blt/std + build CMakeFiles/BLT.dir/src/blt/std/queues.cpp.o: CXX_COMPILER__BLT_Release /home/brett/Documents/code/c++/BLT/src/blt/std/queues.cpp || cmake_object_order_depends_target_BLT DEP_FILE = CMakeFiles/BLT.dir/src/blt/std/queues.cpp.o.d FLAGS = -O3 -DNDEBUG -fdiagnostics-color=always @@ -92,7 +99,7 @@ build CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o: CXX_COMPILER__BLT_Rel ############################################# # Link the static library libBLT.a -build libBLT.a: CXX_STATIC_LIBRARY_LINKER__BLT_Release CMakeFiles/BLT.dir/src/blt/std/queues.cpp.o CMakeFiles/BLT.dir/src/blt/std/random.cpp.o CMakeFiles/BLT.dir/src/blt/std/string.cpp.o CMakeFiles/BLT.dir/src/blt/std/system.cpp.o CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o +build libBLT.a: CXX_STATIC_LIBRARY_LINKER__BLT_Release CMakeFiles/BLT.dir/src/blt/std/logging.cpp.o CMakeFiles/BLT.dir/src/blt/std/queues.cpp.o CMakeFiles/BLT.dir/src/blt/std/random.cpp.o CMakeFiles/BLT.dir/src/blt/std/string.cpp.o CMakeFiles/BLT.dir/src/blt/std/system.cpp.o CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o LANGUAGE_COMPILE_FLAGS = -O3 -DNDEBUG OBJECT_DIR = CMakeFiles/BLT.dir POST_BUILD = : diff --git a/include/blt/std/logging.h b/include/blt/std/logging.h new file mode 100644 index 0000000..98f0d8c --- /dev/null +++ b/include/blt/std/logging.h @@ -0,0 +1,21 @@ +/* + * Created by Brett on 23/01/23. + * Licensed under GNU General Public License V3.0 + * See LICENSE file for license detail + */ + +#ifndef BLT_TESTS_LOGGING_H +#define BLT_TESTS_LOGGING_H + +namespace blt { + void logToConsoleAndFile(const char* format, ...); + void logToConsole(const char* format, ...); + void logToFile(const char* format, ...); + void logToConsoleAndFile(const char* prefix, const char* format, ...); + void logToConsole(const char* prefix, const char* format, ...); + void logToFile(const char* prefix, const char* format, ...); +} + +#define BLT + +#endif //BLT_TESTS_LOGGING_H diff --git a/src/blt/std/logging.cpp b/src/blt/std/logging.cpp new file mode 100644 index 0000000..2e4d199 --- /dev/null +++ b/src/blt/std/logging.cpp @@ -0,0 +1,40 @@ +/* + * Created by Brett on 23/01/23. + * Licensed under GNU General Public License V3.0 + * See LICENSE file for license detail + */ +#include +#include + +// https://en.cppreference.com/w/cpp/utility/variadic +// https://medium.com/swlh/variadic-functions-3419c287a0d2 +// https://publications.gbdirect.co.uk//c_book/chapter9/stdarg.html +// https://cplusplus.com/reference/cstdio/printf/ + +void blt::logToConsoleAndFile(const char* prefix, const char* format, ...) { + +} + +void blt::logToConsole(const char* prefix, const char* format, ...) { + va_list args; + va_start(args, format); + + va_end(args); +} + +void blt::logToFile(const char* prefix, const char* format, ...) { + +} + +void blt::logToConsoleAndFile(const char* format, ...) { + +} + +void blt::logToConsole(const char* format, ...) { + +} + +void blt::logToFile(const char* format, ...) { + +} +