[ox/std] Add oxError and oxErrorf
This commit is contained in:
parent
dc1ead2af4
commit
3ca9db5e8a
3
deps/ox/src/ox/std/trace.hpp
vendored
3
deps/ox/src/ox/std/trace.hpp
vendored
@ -175,6 +175,9 @@ void init();
|
||||
#define oxTracef(ch, fmt, ...) ox::trace::TraceStream(__FILE__, __LINE__, ch, ox::detail::fmtSegments<ox::detail::argCount(fmt)+1>(fmt), ##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#define oxError(...) oxTrace("error", __VA_ARGS__)
|
||||
#define oxErrorf(...) oxTracef("error", __VA_ARGS__)
|
||||
|
||||
#ifndef OX_NODEBUG
|
||||
#define oxDebug(...) oxTrace("debug", __VA_ARGS__)
|
||||
#define oxDebugf(...) oxTracef("debug", __VA_ARGS__)
|
||||
|
6
deps/ox/src/ox/std/tracehook.cpp
vendored
6
deps/ox/src/ox/std/tracehook.cpp
vendored
@ -15,6 +15,8 @@ static const auto OxPrintTrace = std::getenv("OXTRACE") != nullptr;
|
||||
constexpr auto OxPrintTrace = false;
|
||||
#endif
|
||||
|
||||
#include "strops.hpp"
|
||||
|
||||
extern "C" {
|
||||
|
||||
void oxTraceInitHook() {
|
||||
@ -27,6 +29,10 @@ void oxTraceHook([[maybe_unused]] const char *file, [[maybe_unused]] int line,
|
||||
std::cout << std::setw(53) << std::left << ch << "| ";
|
||||
std::cout << std::setw(65) << std::left << msg << '|';
|
||||
std::cout << " " << file << ':' << line << "\n";
|
||||
} else if (ox_strcmp(ch, "debug") == 0) {
|
||||
std::cout << msg << '\n';
|
||||
} else if (ox_strcmp(ch, "error") == 0) {
|
||||
std::cerr << "\033[31;1;1mERROR:\033[0m (" << file << ':' << line << "): " << msg << '\n';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user