From 0a07be9b424e81bb3e638643a0f7d84f622e65e9 Mon Sep 17 00:00:00 2001 From: josh Date: Mon, 12 Jan 2026 11:49:49 -0600 Subject: [PATCH] first commit --- .gitignore | 2 ++ LICENSE.md | 17 +++++++++++++++++ Makefile | 31 +++++++++++++++++++++++++++++++ README.md | 3 +++ include/logger.hpp | 0 main.cpp | 16 ++++++++++++++++ src/logger.cpp | 0 7 files changed, 69 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE.md create mode 100644 Makefile create mode 100644 README.md create mode 100644 include/logger.hpp create mode 100644 main.cpp create mode 100644 src/logger.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c3361d6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +app +liblogger.a diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..aa00394 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,17 @@ +Copyright (C) 2026 Josh Wright + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..80f30be --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +TARGET = app +CXX = g++ -std=c++23 -ggdb -Wall -Wextra -pedantic -O0 +INC = -I./include +LIB_PATH = +LIBS = +HEADERS = include/logger.hpp +SOURCES = src/logger.cpp \ + main.cpp +STATIC = liblogger.a + +all: $(TARGET) + +$(TARGET): $(HEADERS) $(SOURCES) + @$(CXX) $(INC) $(LIB_PATH) $(SOURCES) -o $(TARGET) $(LIBS) + +$(STATIC): include/logger.hpp src/logger.cpp + @g++ -std=c++23 -I./include -c src/logger.cpp -o logger.o + @ar rcs $(STATIC) logger.o + +.PHONY: clean run lib + +clean: + @rm -rf $(TARGET) + @rm -rf $(STATIC) + +run: $(TARGET) + -@./$(TARGET) + @rm -rf $(TARGET) + +lib: $(STATIC) + @rm -rf logger.o diff --git a/README.md b/README.md new file mode 100644 index 0000000..27b42f7 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Cpp Logger + +This is a logger for cpp projects. diff --git a/include/logger.hpp b/include/logger.hpp new file mode 100644 index 0000000..e69de29 diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..27ae001 --- /dev/null +++ b/main.cpp @@ -0,0 +1,16 @@ +#include + +#include "logger.hpp" + +using std::println; + +int main() { + Logger log; + log.addConsoleLogger(); + log.addFileLogger("", "test_log.txt"); + log.addDbLogger(DbType::SqlServer, "test_table"); + log.info("Hello"); + log.error("Oh no"); + + return 0; +} diff --git a/src/logger.cpp b/src/logger.cpp new file mode 100644 index 0000000..e69de29