summaryrefslogtreecommitdiff
path: root/src/info_console.cc
diff options
context:
space:
mode:
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);
}