VERSIÓ 1.3.13
- [NEW] Executant la versió de debug amb el paràmeter "--new" crea un projecte nou en eixe directori. - [NEW] Nou sistema de log - [FIX] Amb el tema de usar std::vector no s'estava inicialitzant la surface de pantalla correctament. - [FIX] Proteccions per a que no pete quan s'intenta usar funcions que els fa falta una surface de oritge, pero no hi ha ninguna seleccionada. - [NEW] file_createFolder() (ATENCIÓ: No funcionarà en Windows encara)
This commit is contained in:
27
log.h
Normal file
27
log.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
enum LogLevel { LOG_OK, LOG_FAIL, LOG_WARN, LOG_INFO, LOG_LUART, LOG_LUALD, LOG_VERBOSE, LOG_UNSALTED };
|
||||
|
||||
static inline void log_msg(enum LogLevel level, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
switch (level) {
|
||||
case LOG_OK: printf("[\033[1;32m OK \033[0m] "); break;
|
||||
case LOG_FAIL: printf("[\033[1;31mFAIL\033[0m] "); break;
|
||||
case LOG_WARN: printf("[\033[1;33mWARN\033[0m] "); break;
|
||||
case LOG_INFO: printf("[\033[1;34mINFO\033[0m] "); break;
|
||||
case LOG_LUART: printf("[\033[1;35mLUA RUNTIME ERROR\033[0m] "); break;
|
||||
case LOG_LUALD: printf("[\033[1;35mLUA LOADING ERROR\033[0m] "); break;
|
||||
case LOG_VERBOSE: printf(" - "); break;
|
||||
case LOG_UNSALTED: break;
|
||||
}
|
||||
vprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
#else
|
||||
#define log_msg(...) ((void)0)
|
||||
#endif
|
||||
Reference in New Issue
Block a user