// tbbmalloc_proxy: \r
// Replace the standard memory allocation routines in Microsoft* C/C++ RTL \r
// (malloc/free, global new/delete, etc.) with the TBB memory allocator. \r
-#include <tbb/tbbmalloc_proxy.h>\r
-\r
-#include "resource.h"\r
-\r
-#include "server.h"\r
\r
#ifdef _DEBUG\r
#define _CRTDBG_MAP_ALLOC\r
#include <stdlib.h>\r
#include <crtdbg.h>\r
+#else\r
+ #include <tbb/tbbmalloc_proxy.h>\r
#endif\r
\r
+#include "resource.h"\r
+\r
+#include "server.h"\r
+\r
#define NOMINMAX\r
#define WIN32_LEAN_AND_MEAN\r
\r
\r
void print_info()\r
{\r
+ CASPAR_LOG(info) << L"################################################################################";\r
CASPAR_LOG(info) << L"Copyright (c) 2010 Sveriges Television AB, www.casparcg.com, <info@casparcg.com>";\r
+ CASPAR_LOG(info) << L"################################################################################";\r
CASPAR_LOG(info) << L"Starting CasparCG Video and Graphics Playout Server " << caspar::env::version();\r
CASPAR_LOG(info) << L"on " << caspar::get_win_product_name() << L" " << caspar::get_win_sp_version();\r
CASPAR_LOG(info) << caspar::get_cpu_info();\r
\r
// Set debug mode.\r
#ifdef _DEBUG\r
- _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF );\r
- _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );\r
- _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_DEBUG );\r
- _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_DEBUG );\r
+ HANDLE hLogFile;\r
+ hLogFile = CreateFile(L"crt_log.txt", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);\r
+ std::shared_ptr<void> crt_log(nullptr, [](HANDLE h){::CloseHandle(h);});\r
+\r
+ _CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);\r
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);\r
+ _CrtSetReportFile(_CRT_WARN, hLogFile);\r
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);\r
+ _CrtSetReportFile(_CRT_ERROR, hLogFile);\r
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);\r
+ _CrtSetReportFile(_CRT_ASSERT, hLogFile);\r
#endif\r
\r
// Increase process priotity.\r
\r
// Install structured exception handler.\r
caspar::win32_exception::install_handler();\r
-\r
- caspar::log::set_log_level(L"debug");\r
- \r
+ \r
// Increase time precision. This will increase accuracy of function like Sleep(1) from 10 ms to 1 ms.\r
struct inc_prec\r
{\r
// Configure environment properties from configuration.\r
caspar::env::configure(L"casparcg.config");\r
\r
+ caspar::log::set_log_level(caspar::env::properties().get(L"configuration.log-level", L"debug"));\r
+\r
#ifdef _DEBUG\r
if(caspar::env::properties().get(L"configuration.debugging.remote", false))\r
MessageBox(nullptr, TEXT("Now is the time to connect for remote debugging..."), TEXT("Debug"), MB_OK | MB_TOPMOST);\r
CASPAR_LOG(fatal) << L"Unhandled configuration error in main thread. Please check the configuration file (casparcg.config) for errors.";\r
system("pause"); \r
}\r
- catch(caspar::gl::ogl_exception&)\r
- {\r
- CASPAR_LOG_CURRENT_EXCEPTION();\r
- CASPAR_LOG(fatal) << L"Unhandled OpenGL Error in main thread. Please try to update graphics drivers for OpenGL 3.0+ Support.";\r
- }\r
catch(...)\r
{\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
CASPAR_LOG(fatal) << L"Unhandled exception in main thread. Please report this error on the CasparCG forums (www.casparcg.com/forum).";\r
+ Sleep(1000);\r
+ std::wcout << L"\n\nCasparCG will automatically shutdown. See the log file located at the configured log-file folder for more information.\n\n";\r
+ Sleep(4000);\r
} \r
\r
return 0;\r