summaryrefslogtreecommitdiff
path: root/src/console.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-09 15:11:46 +0000
committerrubidium <rubidium@openttd.org>2009-09-09 15:11:46 +0000
commit324389cf0b96cf686c2f824b3da249efdbbbd243 (patch)
tree73e3014a1e1b22ccfeab89edd9305c3780cd72e2 /src/console.cpp
parenta8070263366171208f93f9e0613ddb3e717cbf3d (diff)
downloadopenttd-324389cf0b96cf686c2f824b3da249efdbbbd243.tar.xz
(svn r17488) -Feature [FS#2339]: add the date to all logging in the (real, not in-game) console if show_date_in_console is set. For dedicated server binaries the default is 'on', for the rest it is 'off'.
Diffstat (limited to 'src/console.cpp')
-rw-r--r--src/console.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/console.cpp b/src/console.cpp
index 821d5bf62..e1913071f 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -16,6 +16,7 @@
#include "console_internal.h"
#include "network/network.h"
#include "network/network_func.h"
+#include "debug.h"
#include <stdarg.h>
@@ -53,7 +54,9 @@ static void IConsoleWriteToLogFile(const char *string)
{
if (_iconsole_output_file != NULL) {
/* if there is an console output file ... also print it there */
- if (fwrite(string, strlen(string), 1, _iconsole_output_file) != 1 ||
+ const char *header = GetLogPrefix();
+ if (fwrite(header, strlen(header), 1, _iconsole_output_file) != 1 ||
+ fwrite(string, strlen(string), 1, _iconsole_output_file) != 1 ||
fwrite("\n", 1, 1, _iconsole_output_file) != 1) {
fclose(_iconsole_output_file);
_iconsole_output_file = NULL;
@@ -107,7 +110,7 @@ void IConsolePrint(ConsoleColour colour_code, const char *string)
str_validate(str, str + strlen(str));
if (_network_dedicated) {
- fprintf(stdout, "%s\n", str);
+ fprintf(stdout, "%s%s\n", GetLogPrefix(), str);
fflush(stdout);
IConsoleWriteToLogFile(str);
free(str); // free duplicated string since it's not used anymore