12345678910111213141516171819202122232425262728293031323334 |
- #include "core/utils/Logger.h"
- #include <stdarg.h>
- #include <stdio.h>
- CoreLogLevel coreLogLevel = CORE_LOG_DEBUG;
- const char* coreGetShortFileName(const char* s) {
- const char* r = s;
- while(*s != '\0') {
- if(*(s++) == '/') {
- r = s;
- }
- }
- return r;
- }
- void coreLog(CoreLogLevel l, const char* file, int line, const char* prefix,
- const char* tag, const char* format, ...) {
- if(coreLogLevel < l) {
- return;
- }
- file = coreGetShortFileName(file);
- fputs(prefix, stdout);
- fputs(tag, stdout);
- printf("%s:%d | ", file, line);
- va_list args;
- va_start(args, format);
- vprintf(format, args);
- va_end(args);
- puts(CORE_TERMINAL_RESET);
- }
|