-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* flake.nix: use gcc14Stdenv, update --------- Co-authored-by: Mihai Fufezan <[email protected]>
- Loading branch information
Showing
12 changed files
with
108 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,57 @@ | ||
#pragma once | ||
#include <format> | ||
#include <iostream> | ||
#include <string> | ||
|
||
#define LOGMESSAGESIZE 1024 | ||
|
||
enum LogLevel { | ||
NONE = -1, | ||
LOG = 0, | ||
enum eLogLevel { | ||
TRACE = 0, | ||
INFO, | ||
LOG, | ||
WARN, | ||
ERR, | ||
CRIT, | ||
INFO | ||
NONE | ||
}; | ||
|
||
#define RASSERT(expr, reason, ...) \ | ||
if (!(expr)) { \ | ||
Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n{}\n\nat: line {} in {}", \ | ||
std::format(reason, ##__VA_ARGS__), __LINE__, \ | ||
([]() constexpr -> std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \ | ||
std::abort(); \ | ||
} | ||
|
||
#define ASSERT(expr) RASSERT(expr, "?") | ||
|
||
namespace Debug { | ||
void log(LogLevel level, const char* fmt, ...); | ||
} | ||
inline bool quiet = false; | ||
inline bool verbose = false; | ||
|
||
template <typename... Args> | ||
void log(eLogLevel level, const std::string& fmt, Args&&... args) { | ||
|
||
if (!verbose && level == TRACE) | ||
return; | ||
|
||
if (quiet) | ||
return; | ||
|
||
if (level != NONE) { | ||
std::cout << '['; | ||
|
||
switch (level) { | ||
case TRACE: std::cout << "TRACE"; break; | ||
case INFO: std::cout << "INFO"; break; | ||
case LOG: std::cout << "LOG"; break; | ||
case WARN: std::cout << "WARN"; break; | ||
case ERR: std::cout << "ERR"; break; | ||
case CRIT: std::cout << "CRITICAL"; break; | ||
default: break; | ||
} | ||
|
||
std::cout << "] "; | ||
} | ||
|
||
std::cout << std::vformat(fmt, std::make_format_args(args...)) << std::endl; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.