mirror of
https://github.com/encounter/aurora.git
synced 2026-07-09 18:19:33 -07:00
44 lines
956 B
C++
44 lines
956 B
C++
#include <dolphin/os.h>
|
|
#include <dolphin/gx/GXStruct.h>
|
|
|
|
#include "fmt/base.h"
|
|
#include "fmt/printf.h"
|
|
|
|
#include "../../logging.hpp"
|
|
|
|
#include <cstdarg>
|
|
|
|
#if 0
|
|
static aurora::Module reporter("aurora::os::report");
|
|
|
|
void OSReport(const char* msg, ...) {
|
|
va_list args;
|
|
va_start(args, msg);
|
|
OSVReport(msg, args);
|
|
va_end(args);
|
|
}
|
|
|
|
static std::string FormatToString(const char* msg, va_list list) {
|
|
int ret = vsnprintf(nullptr, 0, msg, list);
|
|
std::string buf(ret, '\0');
|
|
vsnprintf(buf.data(), buf.size(), msg, list);
|
|
buf.pop_back();
|
|
return buf;
|
|
}
|
|
|
|
void OSVReport(const char* msg, va_list list) {
|
|
reporter.info("{}", FormatToString(msg, list));
|
|
}
|
|
|
|
void OSPanic(const char* file, int line, const char* msg, ...) {
|
|
va_list args;
|
|
va_start(args, msg);
|
|
reporter.fatal("PANIC {}:{}: {}", file, line, FormatToString(msg, args));
|
|
va_end(args);
|
|
}
|
|
|
|
void OSFatal(GXColor fg, GXColor bg, const char* msg) {
|
|
reporter.fatal("{}", msg);
|
|
}
|
|
#endif
|