void Trace(LPCTSTR pStr, ...) { char szBuff[1024]; va_list va; va_start(va, pStr); wvsprintf (szBuff, pStr, va); va_end(va); #if 0 // change to 0, not to log to a file SYSTEMTIME time; GetLocalTime(&time); FILE* pFile = GetLogStream(); if (pFile) { _ftprintf(pFile, TEXT("%04u/%02u/%02u %02u:%02u:%02u-%03u\t%s\n"), time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond, time.wMilliseconds, szBuff); fflush(pFile); } #endif OutputDebugString(szBuff); }
NS_IMETHODIMP nsMsgFilterList::FlushLogIfNecessary() { // only flush the log if we are logging bool loggingEnabled = false; nsresult rv = GetLoggingEnabled(&loggingEnabled); NS_ENSURE_SUCCESS(rv,rv); if (loggingEnabled) { nsCOMPtr <nsIOutputStream> logStream; rv = GetLogStream(getter_AddRefs(logStream)); if (NS_SUCCEEDED(rv) && logStream) { rv = logStream->Flush(); NS_ENSURE_SUCCESS(rv,rv); } } return rv; }
NS_IMETHODIMP nsSpamSettings::LogJunkString(const char *string) { bool loggingEnabled; nsresult rv = GetLoggingEnabled(&loggingEnabled); NS_ENSURE_SUCCESS(rv,rv); if (!loggingEnabled) return NS_OK; nsCOMPtr <nsIOutputStream> logStream; rv = GetLogStream(getter_AddRefs(logStream)); NS_ENSURE_SUCCESS(rv,rv); PRUint32 writeCount; rv = logStream->Write(LOG_ENTRY_START_TAG, LOG_ENTRY_START_TAG_LEN, &writeCount); NS_ENSURE_SUCCESS(rv,rv); NS_ASSERTION(writeCount == LOG_ENTRY_START_TAG_LEN, "failed to write out start log tag"); // html escape the log for security reasons. // we don't want some to send us a message with a subject with // html tags, especially <script> char *escapedBuffer = MsgEscapeHTML(string); if (!escapedBuffer) return NS_ERROR_OUT_OF_MEMORY; PRUint32 escapedBufferLen = strlen(escapedBuffer); rv = logStream->Write(escapedBuffer, escapedBufferLen, &writeCount); PR_Free(escapedBuffer); NS_ENSURE_SUCCESS(rv,rv); NS_ASSERTION(writeCount == escapedBufferLen, "failed to write out log hit"); rv = logStream->Write(LOG_ENTRY_END_TAG, LOG_ENTRY_END_TAG_LEN, &writeCount); NS_ENSURE_SUCCESS(rv,rv); NS_ASSERTION(writeCount == LOG_ENTRY_END_TAG_LEN, "failed to write out end log tag"); return NS_OK; }
void Aif2XtlSourceClipVisitor::PostOrderVisit( Aif2XtlSourceClipNode& node ) { try { IAAFSourceClipSP spChainedSourceClip = node.GetAif2XtlAAFObject(); AxSourceClip axSrcClip( spChainedSourceClip ); AxMob axReferencedMob( axSrcClip.ResolveRef() ); IAAFMasterMobSP spMasterMob; if ( !AxIsA( axReferencedMob, spMasterMob ) ) { return; } // Decorate this node so that we can easily distingquish it from // other source clips (i.e. master and chained source clips) // later on. std::auto_ptr<Aif2XtlUnMasteredSourceClipDecoration> pSrcClipDec ( new Aif2XtlUnMasteredSourceClipDecoration ); node.PushDecoration( pSrcClipDec ); aafSourceRef_t srcRef = axSrcClip.GetSourceReference(); RejectUnreferencedSlots rejectAllSlotsButThisOne( srcRef.sourceSlotID ); std::auto_ptr<AifParseTreeNode> chainedSubTreeRoot = AifBuildParseTree( axReferencedMob, _nodeFactory, rejectAllSlotsButThisOne ); Aif2XtlSourceClipNode* pRootSrcClipNode = 0; bool notAtEndOfChain = GetChainedSourceClip( *chainedSubTreeRoot, GetLogStream(), &pRootSrcClipNode ); Aif2XtlSourceClipNode* pChainedSrcClipNode = pRootSrcClipNode; // This is a master mob. It should never be the end of the chain. assert(notAtEndOfChain); node.AddChild( chainedSubTreeRoot ); while ( notAtEndOfChain ) { spChainedSourceClip = pChainedSrcClipNode->GetAif2XtlAAFObject(); AxSourceClip axSrcClip( spChainedSourceClip ); AxMob axReferencedMob( axSrcClip.ResolveRef() ); aafSourceRef_t srcRef = axSrcClip.GetSourceReference(); RejectUnreferencedSlots rejectAllSlotsButThisOne( srcRef.sourceSlotID ); std::auto_ptr<AifParseTreeNode> chainedSubTreeRoot = AifBuildParseTree( axReferencedMob, _nodeFactory, rejectAllSlotsButThisOne ); notAtEndOfChain = GetChainedSourceClip( *chainedSubTreeRoot, GetLogStream(), &pChainedSrcClipNode ); pRootSrcClipNode->AddChild( chainedSubTreeRoot ); } } catch( const AxExHResult& ex ) { if ( ex.getHResult() != AAFRESULT_MOB_NOT_FOUND ) { throw; } } }