summaryrefslogtreecommitdiff
path: root/src/log.h
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2005-03-23 20:02:37 +0000
committerYohann Ferreira <bertram@cegetel.net>2005-03-23 20:02:37 +0000
commit255da423d061e6f0ee3db009a7ed2c1ec8e60315 (patch)
treee46230d0ae8a4f61eb35d6bd13e2c5ec0b3bc692 /src/log.h
parent58ffdbff028f763451f471639c6aecc530ca4d94 (diff)
downloadmana-client-255da423d061e6f0ee3db009a7ed2c1ec8e60315.tar.gz
mana-client-255da423d061e6f0ee3db009a7ed2c1ec8e60315.tar.bz2
mana-client-255da423d061e6f0ee3db009a7ed2c1ec8e60315.tar.xz
mana-client-255da423d061e6f0ee3db009a7ed2c1ec8e60315.zip
New log class implementation Part 1/2
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.