[ox/std] Make fmt version of logError
This commit is contained in:
parent
5d5198bf4c
commit
f53b8e38dc
14
deps/ox/src/ox/std/trace.hpp
vendored
14
deps/ox/src/ox/std/trace.hpp
vendored
@ -257,6 +257,18 @@ using TraceStream = OutStream;
|
||||
using TraceStream = NullStream;
|
||||
#endif
|
||||
|
||||
inline void logError(const char *file, int line, const char *fmt, const Error &err) noexcept {
|
||||
if (err) {
|
||||
TraceStream trc(file, line, "ox::error");
|
||||
if (err.file != nullptr) {
|
||||
trc << "Error: (" << err.file << ":" << err.line << "):";
|
||||
} else {
|
||||
trc << "Error:";
|
||||
}
|
||||
trc << sfmt<BasicString<100>>(fmt, static_cast<uint64_t>(err));
|
||||
}
|
||||
}
|
||||
|
||||
inline void logError(const char *file, int line, const Error &err) noexcept {
|
||||
if (err) {
|
||||
TraceStream trc(file, line, "ox::error");
|
||||
@ -271,7 +283,7 @@ void init();
|
||||
|
||||
}
|
||||
|
||||
#define oxLogError(err) ox::trace::logError(__FILE__, __LINE__, err)
|
||||
#define oxLogError(...) ox::trace::logError(__FILE__, __LINE__, __VA_ARGS__)
|
||||
|
||||
#define oxTrace(...) ox::trace::TraceStream(__FILE__, __LINE__, __VA_ARGS__)
|
||||
#define oxOut(...) ox::trace::OutStream(__FILE__, __LINE__, "stdout", __VA_ARGS__)
|
||||
|
Loading…
Reference in New Issue
Block a user