Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
graphite/engine/utility/log.hpp

36 lines
621 B
C++
Raw Normal View History

2024-01-03 16:05:02 -05:00
#pragma once
#include <cstdarg>
#include <cstring>
#include <cstdio>
#include <string>
class Log
{
public:
static void Print(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
vprintf(std::string(fmt + std::string("\n")).c_str(), args);
va_end(args);
}
static void Error(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
vfprintf(stderr, std::string(fmt + std::string("\n")).c_str(), args);
va_end(args);
}
};
#ifdef VDEBUG
#define DEBUG(x, ...) Log::Print(x, __VA_ARGS__);
#else
#define DEBUG(x, ...)
#endif