]> git.sesse.net Git - casparcg/commitdiff
- Less verbose logging. Improved received/sent log messages.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 15 Dec 2011 17:06:38 +0000 (17:06 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 15 Dec 2011 17:06:38 +0000 (17:06 +0000)
- Create path directories if they don't exists.

git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/trunk@1896 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

common/env.cpp
protocol/amcp/AMCPCommandQueue.cpp
protocol/amcp/AMCPProtocolStrategy.cpp
protocol/util/AsyncEventServer.cpp

index 3616397e46e0c04d97973dbf702479dbe059a862..4dde3c7823b0ad46cbd522d995c7f6d2a173cf6e 100644 (file)
@@ -25,7 +25,8 @@
 \r
 #include "../version.h"\r
 \r
-#include "exception\exceptions.h"\r
+#include "exception/exceptions.h"\r
+#include "log/log.h"\r
 #include "utility/string.h"\r
 \r
 #include <boost/property_tree/ptree.hpp>\r
@@ -72,6 +73,30 @@ void configure(const std::wstring& filename)
                std::wcout << L" ### Invalid configuration file. ###";\r
                throw;\r
        }\r
+\r
+       try\r
+       {\r
+               auto media_path = boost::filesystem::wpath(media);\r
+               if(!boost::filesystem::exists(media_path))\r
+                       boost::filesystem::create_directory(media_path);\r
+               \r
+               auto log_path = boost::filesystem::wpath(log);\r
+               if(!boost::filesystem::exists(log_path))\r
+                       boost::filesystem::create_directory(log_path);\r
+               \r
+               auto template_path = boost::filesystem::wpath(ftemplate);\r
+               if(!boost::filesystem::exists(template_path))\r
+                       boost::filesystem::create_directory(template_path);\r
+               \r
+               auto data_path = boost::filesystem::wpath(data);\r
+               if(!boost::filesystem::exists(data_path))\r
+                       boost::filesystem::create_directory(data_path);\r
+       }\r
+       catch(...)\r
+       {\r
+               CASPAR_LOG_CURRENT_EXCEPTION();\r
+               CASPAR_LOG(error) << L"Failed to create configured directories.";\r
+       }\r
 }\r
        \r
 const std::wstring& media_folder()\r
index 72b67333e236eccb3da0a379bab0aa49d038ea8d..3a0f4ddad4a574375ea1cad0525af6857a7463c8 100644 (file)
@@ -49,19 +49,19 @@ void AMCPCommandQueue::AddCommand(AMCPCommandPtr pCurrentCommand)
                        try\r
                        {\r
                                if(pCurrentCommand->Execute()) \r
-                                       CASPAR_LOG(info) << "Executed command: " << pCurrentCommand->print();\r
+                                       CASPAR_LOG(trace) << "Executed command: " << pCurrentCommand->print();\r
                                else \r
-                                       CASPAR_LOG(info) << "Failed to execute command: " << pCurrentCommand->print();\r
+                                       CASPAR_LOG(warning) << "Failed to execute command: " << pCurrentCommand->print();\r
                        }\r
                        catch(...)\r
                        {\r
                                CASPAR_LOG_CURRENT_EXCEPTION();\r
-                               CASPAR_LOG(info) << "Failed to execute command:" << pCurrentCommand->print();\r
+                               CASPAR_LOG(error) << "Failed to execute command:" << pCurrentCommand->print();\r
                        }\r
                                \r
                        pCurrentCommand->SendReply();\r
                        \r
-                       CASPAR_LOG(info) << "Ready for a new command";\r
+                       CASPAR_LOG(trace) << "Ready for a new command";\r
                }\r
                catch(...)\r
                {\r
index 46dcfb3217615028c159077740ddec5b92866889..d7ed9a6452bf0ce30292165f7e9a5e3d71cf6291 100644 (file)
@@ -156,7 +156,7 @@ AMCPCommandPtr AMCPProtocolStrategy::InterpretCommandString(const std::wstring&
        AMCPCommandPtr pCommand;\r
        MessageParserState state = New;\r
 \r
-       CASPAR_LOG(info) << message;\r
+       CASPAR_LOG(info) << L"Received: " << message;\r
 \r
        std::size_t tokensInMessage = TokenizeMessage(message, &tokens);\r
 \r
index e326f6e96ee951bca95fabc3990f76b4074faf9b..9c55c89400ac15e38c93bc499f17f0ec8e8c6ebe 100644 (file)
@@ -434,10 +434,10 @@ void AsyncEventServer::DoSend(SocketInfo& socketInfo) {
                        }\r
                        else {\r
                                if(sentBytes == bytesToSend) {\r
-                                       if(sentBytes < 200)\r
-                                               CASPAR_LOG(info) << "Sent " << socketInfo.sendQueue_.front().c_str() << TEXT(" to ") << socketInfo.host_.c_str();\r
+                                       if(sentBytes < 512)\r
+                                               CASPAR_LOG(info) << "Sent: " << socketInfo.sendQueue_.front().c_str() << TEXT(" to ") << socketInfo.host_.c_str();\r
                                        else\r
-                                               CASPAR_LOG(info) << "Sent more than 200 bytes to " << socketInfo.host_.c_str();\r
+                                               CASPAR_LOG(info) << "Sent more than 512 bytes to " << socketInfo.host_.c_str();\r
 \r
                                        socketInfo.currentlySending_.resize(0);\r
                                        socketInfo.currentlySendingOffset_ = 0;\r