ソースを参照

add OutputDebugStringLoggingChannel

Kolja Strohm 6 ヶ月 前
コミット
e83a8a72ea
2 ファイル変更35 行追加6 行削除
  1. 14 2
      Logging.cpp
  2. 21 4
      Logging.h

+ 14 - 2
Logging.cpp

@@ -562,7 +562,19 @@ Framework::Logging::CoutLoggingChannel::CoutLoggingChannel()
 
 void Framework::Logging::CoutLoggingChannel::writeMessage(const Text& msg) const
 {
-    std::cout << msg.getText();
+    std::cout << msg.getText() << std::endl;
+}
+
+Framework::Logging::OutputDebugStringLoggingChannel::
+    OutputDebugStringLoggingChannel()
+    : LoggingChannel()
+{}
+
+void Framework::Logging::OutputDebugStringLoggingChannel::writeMessage(
+    const Text& msg) const
+{
+    OutputDebugStringA(msg.getText());
+    OutputDebugStringA("\n");
 }
 
 Framework::Logging::ConsoleHandlerLoggingChannel::ConsoleHandlerLoggingChannel(
@@ -694,4 +706,4 @@ void Framework::Logging::LoggingHandler::log(
     {
         channel->writeMessage(message, level, location);
     }
-}
+}

+ 21 - 4
Logging.h

@@ -285,8 +285,27 @@ namespace Framework
              * writes a message to the std::cout.
              *
              * \param msg the message
-             * \param level the log level
-             * \param location the location of the call
+             */
+            DLLEXPORT virtual void writeMessage(const Text& msg) const override;
+        };
+
+        /**
+         * logs messages to OutputDebugString.
+         */
+        class OutputDebugStringLoggingChannel : public LoggingChannel
+        {
+        public:
+            /**
+             * creates a new cout logging channel.
+             *
+             */
+            DLLEXPORT OutputDebugStringLoggingChannel();
+
+        protected:
+            /**
+             * writes a message to OutputDebugString.
+             *
+             * \param msg the message
              */
             DLLEXPORT virtual void writeMessage(const Text& msg) const override;
         };
@@ -313,8 +332,6 @@ namespace Framework
              * writes a message to the given ConsoleHandler.
              *
              * \param msg the message
-             * \param level the log level
-             * \param location the location of the call
              */
             DLLEXPORT virtual void writeMessage(const Text& msg) const override;
         };