more math & testing
This commit is contained in:
@@ -5,18 +5,30 @@
|
||||
|
||||
#include <debugapi.h>
|
||||
|
||||
#define ESC "\x1B["
|
||||
#define YELLOW ESC "33m"
|
||||
#define RED ESC "31m"
|
||||
#define END ESC "39m"
|
||||
|
||||
namespace
|
||||
{
|
||||
char LineBuffer[1024]{0};
|
||||
char OutBuffer[1024]{0};
|
||||
bx::HandleHashMapT<1024> OnceMap;
|
||||
constexpr char LogFormat[]{"%s\n"};
|
||||
constexpr char WarnFormat[]{YELLOW "%s" END "\n"};
|
||||
constexpr char ErrorFormat[]{RED "%s" END "\n"};
|
||||
} // namespace
|
||||
|
||||
void Log(ELogType logType, const char* file, uint32_t line, const char* format, ...)
|
||||
{
|
||||
const char* LineFormat = LogFormat;
|
||||
if (logType == ELogType::Warn) LineFormat = WarnFormat;
|
||||
if (logType == ELogType::Error) LineFormat = ErrorFormat;
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
bx::snprintf(LineBuffer, sizeof(LineBuffer), "%s\n", format);
|
||||
bx::snprintf(LineBuffer, sizeof(LineBuffer), LineFormat, format);
|
||||
bx::vprintf(LineBuffer, args);
|
||||
bx::vsnprintf(OutBuffer, sizeof(OutBuffer), LineBuffer, args);
|
||||
va_end(args);
|
||||
|
||||
Reference in New Issue
Block a user