void handleRequest(x0::HttpRequest *in, const x0::FlowParams& args, x0::FlowValue& result) { std::string filename(args[0].toString()); auto i = logfiles_.find(filename); if (i != logfiles_.end()) { if (i->second.get()) { in->setCustomData<RequestLogger>(this, i->second.get(), in); } } else { auto fileSink = new x0::FileSink(filename, O_APPEND | O_WRONLY | O_CREAT | O_LARGEFILE | O_CLOEXEC, 0644); logfiles_[filename].reset(fileSink); in->setCustomData<RequestLogger>(this, fileSink, in); } }
void CNameLogCommand::Parse( const MSGROOT* message, CListCtrl& listCtrl, CProgressCtrl& progressCtrl, CStatic& resultStatic, CButton& findButton, CButton& stopButton ) const { switch( message->Protocol ) { case MP_RM_NAME_LOG_GET_ACK: { typedef std::map< DWORD, MSG_RM_NAME_LOG::Log > LogMap; LogMap logMap; const MSG_RM_NAME_LOG* m = ( MSG_RM_NAME_LOG* )message; for( DWORD i = 0; i < m->mSize; ++i ) { const MSG_RM_NAME_LOG::Log& log = m->mLog[ i ]; logMap.insert( std::make_pair( log.mIndex, log ) ); } listCtrl.DeleteAllItems(); for( LogMap::const_iterator it = logMap.begin(); logMap.end() != it; ++it ) { const MSG_RM_NAME_LOG::Log& log = it->second; const int row = listCtrl.GetItemCount(); listCtrl.InsertItem( row, CA2WEX< sizeof( log.mDate ) >( log.mDate ), 0 ); // 080402 LUJ, 매크로로 할 경우 함수 안에서 처리하지 않도록 주의하자. 실행 순서가 의존적일 경우 잘못 처리될 수 있다 const CString previousName( CA2WEX< sizeof( log.mPreviousName ) >( log.mPreviousName ) ); const CString name( CA2WEX< sizeof( log.mName ) >( log.mName ) ); CString text; text.Format( _T( "%d" ), log.mIndex ); listCtrl.SetItemText( row, 1, text ); text.Format( _T( "%s > %s" ), previousName, name ); listCtrl.SetItemText( row, 2, text ); } if( logMap.empty() ) { CString textThereIsNoResult; textThereIsNoResult.LoadString( IDS_STRING1 ); MessageBox( 0, textThereIsNoResult, _T( "" ), MB_OK | MB_ICONINFORMATION ); } break; } default: { ASSERT( 0 ); break; } } }