]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Log.hh
sleep forever bug fixed
[chaz/yoink] / src / Moof / Log.hh
index d3e4009c4a5a43f59393a8302922e9995f12bea0..221827f4eb86fcbcb03e4b6b628124b48e6dc8d4 100644 (file)
  */
 
 #include <cstdlib>             // exit
-#include <cerrno>              // errno
-#include <cstring>             // 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)
+#undef ASSERT
+
+#if NDEBUG
+#define ASSERT(X)
+#else
+#define ASSERT(X) if (!(X)) Mf::logError("false assertion at %s:%d, " #X, \
+               __FILE__, __LINE__), exit(1)
+#endif
+
+
+namespace Mf {
 
 
 /**
@@ -61,13 +63,15 @@ 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_SCRIPT              =  3,           ///< Log messages from Lua, too.
+       LOG_INFO                =  4,           ///< Log info, warnings, errors.
+       LOG_DEBUG               =  5,           ///< Log all messages.
+};
 
 
 /**
@@ -112,6 +116,11 @@ void logInfo(const char* fmt, ...);
 
 void logDebug(const char* fmt, ...);
 
+void logScript(const char* fmt, ...);
+class Script;
+int logScript(Script& script);
+void importLogScript(Script& script);
+
 
 } // namespace Mf
 
This page took 0.021987 seconds and 4 git commands to generate.