mirror of
https://github.com/Kugelschieber/vk-experiments.git
synced 2026-01-18 14:50:27 +00:00
Started adding validation layer.
This commit is contained in:
37
src/log.c
Normal file
37
src/log.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "log.h"
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
int logLevel = 0;
|
||||
|
||||
// TODO
|
||||
/*const char* timeStr() {
|
||||
time_t now = time(NULL);
|
||||
struct tm * p = localtime(&now);
|
||||
char buffer[25];
|
||||
strftime(buffer, 25, "%Y-%m-%d %H:%M:%S", p);
|
||||
//buffer[24] = '\0';
|
||||
const char* str = buffer;
|
||||
return str;
|
||||
}*/
|
||||
|
||||
void vkeSetLogLevel(int level) {
|
||||
logLevel = level;
|
||||
}
|
||||
|
||||
void vkeLogDebug(const char* message) {
|
||||
if(logLevel == 0) {
|
||||
time_t now;
|
||||
time(&now);
|
||||
printf("%s [DEBUG] %s\n", ctime(&now), message);
|
||||
}
|
||||
}
|
||||
|
||||
void vkeLogError(const char* message) {
|
||||
if(logLevel > 0) {
|
||||
time_t now;
|
||||
time(&now);
|
||||
printf("%s [ERROR] %s\n", ctime(&now), message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user