From 548228baf58c7497e7dfb23c403dede53144b253 Mon Sep 17 00:00:00 2001 From: iWas-Coder Date: Wed, 8 May 2024 12:53:53 +0200 Subject: [PATCH] Added color to log output --- GNUmakefile | 30 +++++++++++++++--------------- README.org | 2 +- include/sk_log.h | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 9c71907..28c9b56 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -177,7 +177,7 @@ define LUA_CFLAGS $(MACOS_SPECIFIC_CFLAGS_OPTS) endef define CFLAGS - -std=c11 \ + -std=gnu11 \ -Wall \ -Wextra \ -pedantic \ @@ -249,27 +249,27 @@ all: checkdeps .WAIT $(BUILD_DIR) $(RAYLIB_BUILD_DIR) $(LUA_BUILD_DIR) game @: checkdeps: - @for i in $(CHECKDEPS_BINS); do \ - if which $${i} >/dev/null 2>&1; then \ - echo "checking for $${i}... yes"; \ - else \ - echo "checking for $${i}... no"; \ - exit 1; \ - fi; \ + @for i in $(CHECKDEPS_BINS); do \ + if which $${i} >/dev/null 2>&1; then \ + printf "checking for $${i}... \033[1;32myes\033[0m\n"; \ + else \ + printf "checking for $${i}... \033[1;31mno\033[0m\n"; \ + exit 1; \ + fi; \ done @for i in $(CHECKDEPS_HDRS); do \ if echo "#include <$${i}>" | $(CC) -E - >/dev/null 2>&1; then \ - echo "checking for $${i}... yes"; \ + printf "checking for $${i}... \033[1;32myes\033[0m\n"; \ else \ - echo "checking for $${i}... no"; \ + printf "checking for $${i}... \033[1;31mno\033[0m\n"; \ exit 1; \ fi; \ done @for i in $(CHECKDEPS_TYPES); do \ if echo "#include \n#include \n$${i} x;" | gcc -x c -S - -o /dev/stdout >/dev/null 2>&1; then \ - echo "checking for $${i}... yes"; \ + printf "checking for $${i}... \033[1;32myes\033[0m\n"; \ else \ - echo "checking for $${i}... no"; \ + printf "checking for $${i}... \033[1;31mno\033[0m\n"; \ exit 1; \ fi; \ done @@ -291,7 +291,7 @@ $(TEST_BUILD_DIR): $(Q)mkdir -p $@ game: $(OUT) - @echo "INFO: $(OUT) is ready ($(FULL_VERSION))" + @printf "INFO: \033[1;35m$(OUT) is ready ($(FULL_VERSION))\033[0m\n" $(OUT): $(RAYLIB_OUT) $(LUA_OUT) $(LAUNCHER_OUT) $(OBJS) @echo " $(PPO_LD) $@" @@ -327,7 +327,7 @@ $(BUILD_DIR)/%.o: $(SRC_DIR)/%.c $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c -MD $< -o $@ check: checkdeps .WAIT $(BUILD_DIR) $(RAYLIB_BUILD_DIR) $(LUA_BUILD_DIR) $(TEST_BUILD_DIR) $(TEST_OUT) - @echo "INFO: $(TEST_OUT) is ready ($(FULL_VERSION))" + @printf "INFO: \033[1;35m$(TEST_OUT) is ready ($(FULL_VERSION))\033[0m\n" $(Q)./$(TEST_OUT) $(TEST_OUT): $(RAYLIB_OUT) $(LUA_OUT) $(TEST_DEPS_OBJS) $(TEST_OBJS) @@ -339,7 +339,7 @@ $(TEST_BUILD_DIR)/%.o: $(TEST_DIR)/$(SRC_DIR)/%.c $(Q)$(CC) $(TEST_CPPFLAGS) $(TEST_CFLAGS) -c -MD $< -o $@ editor: checkdeps .WAIT $(EDITOR_OUT) - @echo "INFO: $(EDITOR_OUT) is ready ($(FULL_VERSION))" + @printf "INFO: \033[1;35m$(EDITOR_OUT) is ready ($(FULL_VERSION))\033[0m\n" $(EDITOR_OUT): $(EDITOR_SRCS) @if [ ! -e $(FIFO_RSC) ]; then \ diff --git a/README.org b/README.org index f4c5821..70a2a70 100644 --- a/README.org +++ b/README.org @@ -54,7 +54,7 @@ A 5v5 character-based libre tactical shooter #+begin_html

License -C Standard +C Standard Size Release Blazing Speed diff --git a/include/sk_log.h b/include/sk_log.h index df8cdb7..e7d9189 100644 --- a/include/sk_log.h +++ b/include/sk_log.h @@ -24,7 +24,7 @@ #include #define SK_LOG_ENABLE_DEBUG_LEVEL SetTraceLogLevel(LOG_DEBUG) -#define SK_LOG_DEBUG(...) TraceLog(LOG_DEBUG, __VA_ARGS__) -#define SK_LOG_INFO(...) TraceLog(LOG_INFO, __VA_ARGS__) -#define SK_LOG_WARN(...) TraceLog(LOG_WARNING, __VA_ARGS__) -#define SK_LOG_ERROR(...) TraceLog(LOG_ERROR, __VA_ARGS__) +#define SK_LOG_DEBUG(msg, ...) TraceLog(LOG_DEBUG, "\033[1;36m" msg "\033[0m", ##__VA_ARGS__) +#define SK_LOG_INFO(msg, ...) TraceLog(LOG_INFO, "\033[1;35m" msg "\033[0m", ##__VA_ARGS__) +#define SK_LOG_WARN(msg, ...) TraceLog(LOG_WARNING, "\033[1;33m" msg "\033[0m", ##__VA_ARGS__) +#define SK_LOG_ERROR(msg, ...) TraceLog(LOG_ERROR, "\033[1;31m" msg "\033[0m", ##__VA_ARGS__)