From 560877d89847b25b201580e083119f0b23ff75c1 Mon Sep 17 00:00:00 2001
From: Chuck Miller <shadowmil@gmail.com>
Date: Sun, 15 Aug 2010 20:56:08 -0400
Subject: Remove the logToChat option

This is a very old legacy option.  Today its not very
useful because the logger had become quite verbose that
using it during run-time is not helpful.

Reviewed-By: Jared Adams
Reviewed-By: Freeyorp
---
 src/game.cpp      |  6 ------
 src/log.cpp       | 13 ++++---------
 src/log.h         |  8 --------
 src/utils/xml.cpp |  2 +-
 4 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/src/game.cpp b/src/game.cpp
index 18bad69c..8d6440b7 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -172,11 +172,6 @@ static void createGuiWindows()
 
     localChatTab = new ChatTab(_("General"));
 
-    if (config.getValue("logToChat", 0))
-    {
-        logger->setChatWindow(chatWindow);
-    }
-
     NpcDialog::setup();
 
     Mana::Event::trigger("Game", "GuiWindowsLoaded");
@@ -191,7 +186,6 @@ static void destroyGuiWindows()
 {
     Mana::Event::trigger("Game", "GuiWindowsUnloading");
 
-    logger->setChatWindow(NULL);
     del_0(localChatTab) // Need to do this first, so it can remove itself
     del_0(chatWindow)
     del_0(statusWindow)
diff --git a/src/log.cpp b/src/log.cpp
index 435b2da0..0da9a272 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -22,9 +22,10 @@
 #include <iostream>
 #include <sstream>
 
-#include "log.h"
+#include <stdio.h>
+#include <stdarg.h>
 
-#include "gui/widgets/chattab.h"
+#include "log.h"
 
 #ifdef WIN32
 #include <windows.h>
@@ -37,8 +38,7 @@
 #include <sys/time.h>
 
 Logger::Logger():
-    mLogToStandardOut(true),
-    mChatWindow(NULL)
+    mLogToStandardOut(true)
 {
 }
 
@@ -101,11 +101,6 @@ void Logger::log(const char *log_text, ...)
         std::cout << timeStr.str() << buf << std::endl;
     }
 
-    if (mChatWindow)
-    {
-        localChatTab->chatLog(buf, BY_LOGGER);
-    }
-
     // Delete temporary buffer
     delete[] buf;
 }
diff --git a/src/log.h b/src/log.h
index 50fca577..4615f626 100644
--- a/src/log.h
+++ b/src/log.h
@@ -24,8 +24,6 @@
 
 #include <fstream>
 
-class ChatWindow;
-
 /**
  * The Log Class : Useful to write debug or info messages
  */
@@ -52,11 +50,6 @@ class Logger
          */
         void setLogToStandardOut(bool value) { mLogToStandardOut = value; }
 
-        /**
-         * Enables logging to chat window
-         */
-        void setChatWindow(ChatWindow *window) { mChatWindow = window; }
-
         /**
          * Enters a message in the log. The message will be timestamped.
          */
@@ -75,7 +68,6 @@ class Logger
     private:
         std::ofstream mLogFile;
         bool mLogToStandardOut;
-        ChatWindow *mChatWindow;
 };
 
 extern Logger *logger;
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index bb386f51..2bcb6f24 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -162,7 +162,7 @@ namespace XML
             logger->log("Error in unknown xml file on line %d",
                         error->line);
 
-        logger->log(error->message);
+        logger->log("%s", error->message);
 
         // No need to keep errors around
         xmlCtxtResetLastError(error->ctxt);
-- 
cgit v1.2.3-70-g09d2