diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-02-14 00:53:22 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-02-14 00:53:22 +0000 |
commit | 812103cea68f1da2004dd518c5ad3b448a0e1729 (patch) | |
tree | b4bc86a077385a219474bcb5bca727e0703ed52b /src/log.cpp | |
parent | 3628aae5ef1be719603d4aa8e1b209cf5e04520c (diff) | |
download | mana-812103cea68f1da2004dd518c5ad3b448a0e1729.tar.gz mana-812103cea68f1da2004dd518c5ad3b448a0e1729.tar.bz2 mana-812103cea68f1da2004dd518c5ad3b448a0e1729.tar.xz mana-812103cea68f1da2004dd518c5ad3b448a0e1729.zip |
Simplified logging for the sake of simplicity.
Diffstat (limited to 'src/log.cpp')
-rw-r--r-- | src/log.cpp | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/src/log.cpp b/src/log.cpp index 4a66a223..e2f0ac36 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -37,7 +37,7 @@ void init_log() } } -void log(const char *category, const char *log_text, ...) +void log(const char *log_text, ...) { if (logfile) { @@ -55,14 +55,14 @@ void log(const char *category, const char *log_text, ...) // Print the log entry fprintf(logfile, - "[%s%d:%s%d:%s%d] %s: %s\n", + "[%s%d:%s%d:%s%d] %s\n", (((t / 60) / 60) % 24 < 10) ? "0" : "", (int)(((t / 60) / 60) % 24), ((t / 60) % 60 < 10) ? "0" : "", (int)((t / 60) % 60), (t % 60 < 10) ? "0" : "", (int)(t % 60), - category, buf + buf ); // Flush the log file @@ -73,34 +73,9 @@ void log(const char *category, const char *log_text, ...) } } -void log(const std::string &text) -{ - if (logfile) - { - // Get the current system time - time_t t; - time(&t); - - // Print the log entry - fprintf(logfile, - "[%s%d:%s%d:%s%d] %s\n", - (((t / 60) / 60) % 24 < 10) ? "0" : "", - (int)(((t / 60) / 60) % 24), - ((t / 60) % 60 < 10) ? "0" : "", - (int)((t / 60) % 60), - (t % 60 < 10) ? "0" : "", - (int)(t % 60), - text.c_str() - ); - - // Flush the log file - fflush(logfile); - } -} - void error(const std::string &error_text) { - log("Error", error_text.c_str()); + log(error_text.c_str()); #ifdef WIN32 MessageBox(NULL, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); @@ -109,13 +84,3 @@ void error(const std::string &error_text) #endif exit(1); } - -void warning(const char *warning_text) -{ - log("Warning", warning_text); -} - -void status(const char *status_text) -{ - log("Status", status_text); -} |