void LogHelper::PrintInformations( const QString& text ) { setlocale(LC_ALL,"chs"); QString str_texts = GetCurrentDateTimeString() + text; //qDebug() << str_texts; std::wstring s ;//= str_texts.toStdWString(); const wchar_t* l = s.c_str(); wprintf(L"%s\n",l); }
void SessionServer::TeardownFileLogger() { time_t curTime = time(NULL); tm curTM; localtime_s(&curTM, &curTime); m_logger->ClearWriter(); std::string curTimeString = GetCurrentDateTimeString(curTM); LogInfo(" ** Logging Session Ended at %s", curTimeString.c_str()); if (m_logWriter) { delete m_logWriter; m_logWriter = NULL; } }
void SessionServer::InitializeFileLogger() { time_t curTime = time(NULL); tm curTM; localtime_s(&curTM, &curTime); if (!m_logWriter) { std::string filePath = s_defaultLogBaseLocation; filePath += "SharingServiceLogs"; filePath += "\\"; BOOL dirResult = CreateDirectoryA(filePath.c_str(), NULL); if (dirResult || GetLastError() == ERROR_ALREADY_EXISTS) { // Either we succeeded in creating the directory or it already exists. std::string fileName = "SharingService_"; fileName += std::to_string(curTM.tm_year + 1900); fileName += std::to_string(curTM.tm_mon + 1); fileName += std::to_string(curTM.tm_mday); fileName += ".log"; std::string fullPath = filePath + GetLogFileName(curTM); m_logWriter = new FileLogWriter(); m_logWriter->AddTargetFile(fullPath); } } m_logger = new Logger(); m_logger->SetWriter(m_logWriter); std::string curTimeString = GetCurrentDateTimeString(curTM); LogInfo(" ** Logging Session Began at %s", curTimeString.c_str()); }
void emit_definitions( const wrSourceFile& srcFile ) { OSFileName fileName = GetDestFileName( srcFile.name, WR_SOURCE_FILE_EXT ); FileWriter outputStream( fileName.ToChars() ); mxTextWriter tw( &outputStream ); tw << MXC("/* This ALWAYS GENERATED file contains the implementation for the interfaces */\n") << MXC("/* File created by HLSL wrapper generator version ") << WR_VERSION_STRING << MXC(" ") << GetCurrentDateTimeString() << MXC(" */\n") ; tw << MXC("namespace ") << WR_NAMESPACE << MXC("\n{\n"); // Initialization order: // 1) Render targets // 2) State objects // 3) Shaders // 4) Input layouts // 5) Everything else /* TList< const wrRenderTarget* > sortedRTs; for( UINT iRenderTarget = 0; iRenderTarget < srcFile.renderTargets.Num(); iRenderTarget++ ) { sortedRTs.Add( &srcFile.renderTargets[ iRenderTarget ] ); } // Sort render targets by size. InsertionSort< const wrRenderTarget*, wrRenderTarget >( sortedRTs.ToPtr(), 0, sortedRTs.Num()-1 ); */ Emit_initialize_render_targets( srcFile.renderTargets, tw ); emit_line_separator_comment( tw ); Emit_initialize_sampler_states( srcFile.samplerStates, tw ); emit_line_separator_comment( tw ); emit_initialize_depth_stencil_states( srcFile.depthStencilStates, tw ); tw << MXC("void SetupGPUResources( const SHADER_LIB_CREATE& creationParams )\n{\n") ; tw << MXC("\n}//SetupGPUResources\n") << MXC("SetupRenderTargets( creationParams );\n") << MXC("SetupSamplerStates( creationParams );\n") << MXC("SetupDepthStencilStates( creationParams );\n") << MXC("SetupRasterizerStates( creationParams );\n") << MXC("SetupBlendStates( creationParams );\n") ; tw << MXC("\n}//SetupGPUResources\n") ; tw << MXC("\n}//namespace ") << WR_NAMESPACE << MXC("\n"); }
void emit_declarations( const wrSourceFile& srcFile ) { OSFileName fileName = GetDestFileName( srcFile.name, WR_HEADER_FILE_EXT ); FileWriter outputStream( fileName.ToChars() ); mxTextWriter tw( &outputStream ); tw << MXC("/* This ALWAYS GENERATED file contains the definitions for the interfaces */\n") << MXC("/* File created by HLSL wrapper generator version ") << WR_VERSION_STRING << MXC(" ") << GetCurrentDateTimeString() << MXC(" */\n") ; tw << MXC("namespace ") << WR_NAMESPACE << MXC("\n{\n"); tw << MXC("// Render targets\n"); emit_render_target_declarations( srcFile.renderTargets, tw ); tw << MXC("// Sampler states\n"); emit_sampler_state_declarations( srcFile.samplerStates, tw ); tw << MXC("// Depth-stencil states\n"); emit_depth_stencil_states_declarations( srcFile.depthStencilStates, tw ); tw << MXC("\n}//namespace ") << WR_NAMESPACE << MXC("\n"); }
void LogHelper::PrintErrors( const QString& text ) { QString str_texts = GetCurrentDateTimeString() + " Errors: " + text; qDebug() << str_texts; }