[ox/std] Replace std::cerr with oxErrf
This commit is contained in:
parent
ac9cd26367
commit
1aebe93c52
12
deps/ox/src/ox/std/assert.cpp
vendored
12
deps/ox/src/ox/std/assert.cpp
vendored
@ -6,10 +6,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#if defined(OX_USE_STDLIB)
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
#include "stacktrace.hpp"
|
||||
#include "trace.hpp"
|
||||
|
||||
@ -20,13 +16,13 @@ namespace ox {
|
||||
void panic([[maybe_unused]]const char *file, [[maybe_unused]]int line, [[maybe_unused]]const char *panicMsg, [[maybe_unused]]const Error &err) noexcept {
|
||||
#ifdef OX_USE_STDLIB
|
||||
if (!std::is_constant_evaluated()) {
|
||||
std::cerr << "\033[31;1;1mPANIC:\033[0m (" << file << ':' << line << "): " << panicMsg << '\n';
|
||||
oxErrf("\033[31;1;1mPANIC:\033[0m [{}:{}]: {}\n", file, line, panicMsg);
|
||||
if (err.msg) {
|
||||
std::cerr << "\tError Message:\t" << err.msg << '\n';
|
||||
oxErrf("\tError Message:\t{}\n", err.msg);
|
||||
}
|
||||
std::cerr << "\tError Code:\t" << err << '\n';
|
||||
oxErrf("\tError Code:\t{}\n", static_cast<ErrorCode>(err));
|
||||
if (err.file != nullptr) {
|
||||
std::cerr << "\tError Location:\t" << err.file << ':' << err.line << '\n';
|
||||
oxErrf("\tError Location:\t{}:{}\n", err.file, err.line);
|
||||
}
|
||||
printStackTrace(2);
|
||||
oxTrace("panic").del("") << "Panic: " << panicMsg << " (" << file << ":" << line << ")";
|
||||
|
17
deps/ox/src/ox/std/assert.hpp
vendored
17
deps/ox/src/ox/std/assert.hpp
vendored
@ -36,12 +36,9 @@ constexpr void assertFunc(const char *file, int line, bool pass, [[maybe_unused]
|
||||
if (!pass) {
|
||||
if (!std::is_constant_evaluated()) {
|
||||
#ifdef OX_USE_STDLIB
|
||||
std::cerr << "\033[31;1;1mASSERT FAILURE:\033[0m " << assertTxt << " [" << file << ':' << line << "]: "
|
||||
<< msg << std::endl;
|
||||
oxErrf("\033[31;1;1mASSERT FAILURE:\033[0m [{}:{}]: {}\n", file, line, msg);
|
||||
printStackTrace(2);
|
||||
oxTrace("assert").del("") << "Failed assert: " << msg << " (" << assertTxt << ") " << " [" << file
|
||||
<< ":"
|
||||
<< line << "]";
|
||||
oxTracef("assert", "Failed assert: {} ({}) [{}:{}]", msg, assertTxt, file, line);
|
||||
std::abort();
|
||||
#else
|
||||
constexprPanic(file, line, msg);
|
||||
@ -56,16 +53,16 @@ constexpr void assertFunc(const char *file, int line, const Error &err, const ch
|
||||
if (err) {
|
||||
if (!std::is_constant_evaluated()) {
|
||||
#if defined(OX_USE_STDLIB)
|
||||
std::cerr << "\033[31;1;1mASSERT FAILURE:\033[0m (" << file << ':' << line << "): " << assertMsg << '\n';
|
||||
oxErrf("\033[31;1;1mASSERT FAILURE:\033[0m [{}:{}]: {}\n", file, line, assertMsg);
|
||||
if (err.msg) {
|
||||
std::cerr << "\tError Message:\t" << err.msg << '\n';
|
||||
oxErrf("\tError Message:\t{}\n", err.msg);
|
||||
}
|
||||
std::cerr << "\tError Code:\t" << err << '\n';
|
||||
oxErrf("\tError Code:\t{}\n", static_cast<ErrorCode>(err));
|
||||
if (err.file != nullptr) {
|
||||
std::cerr << "\tError Location:\t" << err.file << ':' << err.line << '\n';
|
||||
oxErrf("\tError Location:\t{}:{}\n", err.file, err.line);
|
||||
}
|
||||
printStackTrace(2);
|
||||
oxTrace("constexprPanic").del("") << "Panic: " << assertMsg << " [" << file << ":" << line << "]";
|
||||
oxTracef("assert", "Failed assert: {} [{}:{}]", assertMsg, file, line);
|
||||
std::abort();
|
||||
#else
|
||||
constexprPanic(file, line, assertMsg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user