* Convenience function to check if a condition is true, if not log an error * message and exit. * * @param condition: The condition to check. * @param message: The error message to log if the condition is false. * @param file: The file where the error occurred. * @param line: The line where the error occurred. */
| 39 | * @param line: The line where the error occurred. |
| 40 | */ |
| 41 | inline void check(bool condition, const char *message, |
| 42 | const char *file = "unkown", int line = -1) { |
| 43 | if (!condition) { |
| 44 | spdlog::error("Error in file {} line {}:\n{}", file, line, message); |
| 45 | exit(1); |
| 46 | } else { |
| 47 | spdlog::trace("Success in file {} line {}:\n{}", file, line, message); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | /* |
| 52 | * Convenience function to display the first few elements of an array. A more |