summaryrefslogtreecommitdiff
path: root/src/info_console.cc
diff options
context:
space:
mode:
authordeva <deva>2005-06-14 12:29:40 +0000
committerdeva <deva>2005-06-14 12:29:40 +0000
commit430524810e67d3c223a2ab819f45b882b419c45d (patch)
tree0abb4b2dd3dabc414c755c30e52d0b5022ee8670 /src/info_console.cc
parent0836a6e06f86e366017da3b2b2c132b3a4f2c877 (diff)
Incorporated the use of the Info object everywhere... also using the log functionality.
Diffstat (limited to 'src/info_console.cc')
-rw-r--r--src/info_console.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/info_console.cc b/src/info_console.cc
index f703a3f..a860dd8 100644
--- a/src/info_console.cc
+++ b/src/info_console.cc
@@ -41,9 +41,10 @@
#include <stdio.h>
#include <stdarg.h>
-InfoConsole::InfoConsole(): Info()
+InfoConsole::InfoConsole(MiavConfig *c): Info()
{
- log_filename = *config->readString("server_log_file");
+ this->config = c;
+ log_filename = *(this->config->readString("server_log_file"));
}
InfoConsole::~InfoConsole()
@@ -60,12 +61,14 @@ void InfoConsole::error(char *fmt, ...)
va_list argp;
va_start(argp, fmt);
- fprintf(stderr, "Error: ["); vfprintf(stderr, fmt, argp); fprintf(stderr, "]\n"); fflush(stderr);
+ // fprintf(stderr, "Error: ["); vfprintf(stderr, fmt, argp); fprintf(stderr, "]\n"); fflush(stderr);
vsprintf(buf, fmt, argp);
va_end(argp);
// End of safezone
pthread_mutex_unlock(&mutex);
+
+ log("Error: %s", buf);
}
void InfoConsole::warn(char *fmt, ...)
@@ -77,12 +80,14 @@ void InfoConsole::warn(char *fmt, ...)
va_list argp;
va_start(argp, fmt);
- fprintf(stderr, "Warning: ["); vfprintf(stderr, fmt, argp); fprintf(stderr, "]\n"); fflush(stderr);
+ // fprintf(stderr, "Warning: ["); vfprintf(stderr, fmt, argp); fprintf(stderr, "]\n"); fflush(stderr);
vsprintf(buf, fmt, argp);
va_end(argp);
// End of safezone
pthread_mutex_unlock(&mutex);
+
+ log("Warning: %s", buf);
}
void InfoConsole::info(char *fmt, ...)
@@ -94,10 +99,12 @@ void InfoConsole::info(char *fmt, ...)
va_list argp;
va_start(argp, fmt);
- fprintf(stderr, "Info: ["); vfprintf(stderr, fmt, argp); fprintf(stderr, "]\n"); fflush(stderr);
+ // fprintf(stderr, "Info: ["); vfprintf(stderr, fmt, argp); fprintf(stderr, "]\n"); fflush(stderr);
vsprintf(buf, fmt, argp);
va_end(argp);
// End of safezone
pthread_mutex_unlock(&mutex);
+
+ log("Info: %s", buf);
}