mirror of
https://github.com/Kugelschieber/vk-experiments.git
synced 2026-01-18 06:40:27 +00:00
Added info and warn log levels.
This commit is contained in:
14
src/log.c
14
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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user