dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / scd_logging.h
diff --git a/dol/src/dol/visitor/hdsd/scd/scd_logging.h b/dol/src/dol/visitor/hdsd/scd/scd_logging.h
new file mode 100644 (file)
index 0000000..9112dc8
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef SCD_LOGGING_H
+#define SCD_LOGGING_H
+
+#include <string>
+using std::string;
+
+/* Loglevels. Default is SCD_INFO */
+typedef int scd_loglevel;
+const scd_loglevel SCD_DEBUG = 0;
+const scd_loglevel SCD_INFO = 1;
+const scd_loglevel SCD_WARN = 2;
+const scd_loglevel SCD_ERROR = 3;
+
+/**
+ * Log message if the current loglevel is low enough.
+ */
+void scd_log(const scd_loglevel &level, const string &str);
+
+/**
+ * Log message with loglevel SCD_DEBUG.
+ */
+inline void scd_debug(const string &str)
+{
+    scd_log(SCD_DEBUG, str);
+}
+
+/**
+ * Log message with loglevel SCD_INFO.
+ */
+inline void scd_info(const string &str)
+{
+    scd_log(SCD_INFO, str);
+}
+
+/**
+ * Log message with loglevel SCD_WARN.
+ */
+inline void scd_warn(const string &str)
+{
+    scd_log(SCD_WARN, str);
+}
+
+/**
+ * Log message with loglevel SCD_ERROR.
+ */
+inline void scd_error(const string &str)
+{
+    scd_log(SCD_ERROR, str);
+}
+
+/**
+ * Set the current loglevel. Events with lower priorities are not logged.
+ */
+void scd_set_loglevel(const scd_loglevel &level);
+
+#endif