36 lines
No EOL
621 B
C++
36 lines
No EOL
621 B
C++
#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 |