core/log.hpp file

Logging and assertion macros.

Namespaces

namespace cubos
Cubos libraries namespace.
namespace cubos::core
Core namespace.

Classes

class cubos::core::Logger
Singleton which holds the logging state.
struct cubos::core::Logger::Location
Identifies a location in the code.
struct cubos::core::Logger::Timestamp
A timestamp used to identify when a logging message was written.
struct cubos::core::Logger::Entry
Data created by a call to log.

Functions

void abort()
Aborts the program and prints a pretty stack trace.

Defines

#define CUBOS_LOG_LEVEL_TRACE
Trace log level, lowest log level. Very verbose.
#define CUBOS_LOG_LEVEL_DEBUG
Debug log level. Contains messages useful for debugging, but which are not necessary in release builds.
#define CUBOS_LOG_LEVEL_INFO
Information log level. Contains important events that are not errors.
#define CUBOS_LOG_LEVEL_WARN
Warn log level. Contains events that are not errors, but which are unexpected and may be problematic.
#define CUBOS_LOG_LEVEL_ERROR
Error log level. Contains errors which are recoverable from.
#define CUBOS_LOG_LEVEL_CRITICAL
Critical log level, highest log level. Contains errors which are unrecoverable from.
#define CUBOS_LOG_LEVEL_OFF
Off log level, disables all logging.
#define CUBOS_LOG_LEVEL
Log level to compile in.
#define CUBOS_TRACE(...)
Used for logging very verbose information.
#define CUBOS_DEBUG(...)
Used for logging information which is useful for debugging but not necessary in release builds.
#define CUBOS_INFO(...)
Used for logging information which is useful in release builds.
#define CUBOS_WARN(...)
Used for logging unexpected events.
#define CUBOS_ERROR(...)
Used for logging recoverable errors.
#define CUBOS_CRITICAL(...)
Used for logging unrecoverable errors.
#define CUBOS_LOG(level, ...)
Used for logging messages.
#define CUBOS_FAIL(...)
Aborts a program, optionally printing a critical error message.
#define CUBOS_UNREACHABLE(...)
Marks a code path as supposedly unreachable. Aborts the program when reached.
#define CUBOS_TODO(...)
Marks a code path as unfinished. Aborts the program when reached.
#define CUBOS_ASSERT(cond, ...)
Asserts that a condition is true, aborting the program if it is not.
#define CUBOS_ASSERT_IMP(cond, cons, ...)
Asserts that an implication is true, aborting the program if it is not.
#define CUBOS_DEBUG_ASSERT(cond, ...)
In debug builds asserts that a condition is true, aborting the program if it is not.