From ad33883c35f8d150cb461a5f49a77edad37f78eb Mon Sep 17 00:00:00 2001 From: Marvin Blum Date: Wed, 9 Jun 2021 19:52:02 +0200 Subject: [PATCH] Added info and warn log levels. --- src/log.c | 14 +++++++++++++- src/log.h | 8 ++++++++ src/main.c | 5 ++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/log.c b/src/log.c index ee3e68e..168cd3e 100644 --- a/src/log.c +++ b/src/log.c @@ -19,11 +19,23 @@ void vkeSetLogLevel(int level) { } void vkeLogDebug(const char* message) { - if(logLevel < VKE_LOG_ERROR) { + if(logLevel < VKE_LOG_INFO) { printf("%s [DEBUG] %s\n", timeNow(), message); } } +void vkeLogInfo(const char* message) { + if(logLevel < VKE_LOG_WARN) { + printf("%s [INFO] %s\n", timeNow(), message); + } +} + +void vkeLogWarn(const char* message) { + if(logLevel < VKE_LOG_ERROR) { + printf("%s [WARN] %s\n", timeNow(), message); + } +} + void vkeLogError(const char* message) { if(logLevel < VKE_LOG_ERROR+1) { printf("%s [ERROR] %s\n", timeNow(), message); diff --git a/src/log.h b/src/log.h index 8813834..ee0bfa9 100644 --- a/src/log.h +++ b/src/log.h @@ -2,6 +2,8 @@ #define VKE_LOG_H #define VKE_LOG_DEBUG 0 +#define VKE_LOG_INFO 0 +#define VKE_LOG_WARN 0 #define VKE_LOG_ERROR 1 // Sets the global log level (VKE_LOG_DEBUG by default). @@ -10,6 +12,12 @@ void vkeSetLogLevel(int level); // Logs the given message with the DEBUG tag. void vkeLogDebug(const char* message); +// Logs the given message with the INFO tag. +void vkeLogInfo(const char* message); + +// Logs the given message with the WARN tag. +void vkeLogWarn(const char* message); + // Logs the given message with the ERROR tag. void vkeLogError(const char* message); diff --git a/src/main.c b/src/main.c index 8e6e690..b783e80 100644 --- a/src/main.c +++ b/src/main.c @@ -74,11 +74,10 @@ int vkeInit(struct VKEContext* ctx, struct VKEConfig* config) { .pApplicationInfo = &appInfo }; - // TODO - /*if(config->validationLayerCount > 0) { + if(config->validationLayerCount > 0) { createInfo.enabledLayerCount = config->validationLayerCount; createInfo.ppEnabledExtensionNames = config->validationLayers; - }*/ + } if(vkCreateInstance(&createInfo, NULL, &ctx->instance) != VK_SUCCESS) { vkeLogError("error creating vulkan instance\n");