X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FLog.hh;h=cdd5cd4e751e8e4374b94babbcc2be10f249f991;hp=d3e4009c4a5a43f59393a8302922e9995f12bea0;hb=8ad81a8282ce6e9e488a453e6bcd05fbc09715dc;hpb=5fa5f117f28922a7e539a432367960c1a61f837d diff --git a/src/Moof/Log.hh b/src/Moof/Log.hh index d3e4009..cdd5cd4 100644 --- a/src/Moof/Log.hh +++ b/src/Moof/Log.hh @@ -37,22 +37,23 @@ */ #include // exit -#include // errno #include // strerror -namespace Mf { - - /** * Macro which tests an assertion and issues an logError() and exits if false. - * This differs from the standard assert() in that this is a runtime assertion - * test and will always be compiled in. * @param X test to perform */ -#define ASSERT(X) if (!(X)) logError("false assertion at %s:%d, " #X \ - " (errno: %d, %s)", __FILE__, __LINE__, errno, strerror(errno)), exit(1) +#if ! NDEBUG +#define ASSERT(X) if (!(X)) Mf::logError("false assertion at %s:%d, " #X, \ + __FILE__, __LINE__), exit(1) +#else +#define ASSERT(X) +#endif + + +namespace Mf { /** @@ -61,13 +62,14 @@ namespace Mf { * @see LogLevel() */ -typedef enum { - NONE = -1, ///< Disable all logging. - ERROR = 1, ///< Log only errors. - WARNING = 2, ///< Log warnings and errors. - INFO = 3, ///< Log info, warnings, errors. - DEBUGGING = 4 ///< Log all messages. -} LogLevel; +enum LogLevel +{ + LOG_NONE = -1, ///< Disable all logging. + LOG_ERROR = 1, ///< Log only errors. + LOG_WARNING = 2, ///< Log warnings and errors. + LOG_INFO = 3, ///< Log info, warnings, errors. + LOG_DEBUG = 4 ///< Log all messages. +}; /**