summaryrefslogtreecommitdiff
path: root/src/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/log.h')
-rw-r--r--src/log.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/log.h b/src/log.h
index e85ddd6b..99c9a0a8 100644
--- a/src/log.h
+++ b/src/log.h
@@ -27,6 +27,45 @@
#include <stdarg.h>
#include <time.h>
#include <string>
+#include <iostream>
+#include <fstream>
+
+/**
+ * The Log Class : Useful to write debug or info messages
+ */
+class Logger
+{
+public:
+
+/**
+ * Constructor :
+ * Initializes log file by opening it for writing.
+ */
+Logger(std::string logFilename);
+
+/**
+ * Destructor
+ */
+~Logger();
+
+/**
+ * Enters a message in the log. The message will be timestamped.
+ */
+void log(std::string log_text);
+void log(const char *log_text, ...);
+
+/**
+ * Log an error and quit. The error will pop-up in Windows and will be printed
+ * to standard error everywhere else.
+ */
+void error(const std::string &error_text);
+
+private:
+
+std::ofstream logFile;
+
+};
+
/**
* Initializes log file by opening it for writing.