|
#include <stdafx.h>
#include <fstream>
#include <wxdebug.h>
#include "ErrorLog.h"
namespace DESCombineLib {
/*
=====================================================================
=====================================================================
ErrorLog
=====================================================================
=====================================================================
*/
/*
=====================================================================
=====================================================================
*/
ErrorLog::ErrorLog(TCHAR *name, LPUNKNOWN unknown, HRESULT *phr)
: CUnknown( name, unknown, phr )
{
}
/*
=====================================================================
=====================================================================
*/
STDMETHODIMP ErrorLog::LogError(
LONG Severity, // Reserved. Do not use.
BSTR ErrorString, // Description.
LONG ErrorCode, // Error code.
HRESULT hresult, // HRESULT that caused the error.
VARIANT *extraInfo // Extra information about the error.
) {
std::wostringstream os;
os << std::endl;
if( ErrorString )
os << L"ErrorString = " << std::wstring( ErrorString ) << std::endl;
os << L"ErrorCode = " << ErrorCode << std::endl;
os << L"hresult = 0x" << std::hex << hresult; // do not append 'std::endl';
if( extraInfo ) {
os << std::endl;
if( VT_BSTR == extraInfo->vt )
os << L"extra information = " << extraInfo->bstrVal;
else
os << L"extraInfo #" << extraInfo->vt;
}
DbgLog( (LOG_ERROR, 5, os.str().c_str()) );
::OutputDebugString( _T("\n") );
::OutputDebugString( os.str().c_str() );
::OutputDebugString( _T("\n\n") );
ASSERT( !"better check this error" );
return S_OK;
}
/*
=====================================================================
=====================================================================
*/
STDMETHODIMP ErrorLog::NonDelegatingQueryInterface( REFIID riid, void **ppv )
{
if( IID_IAMErrorLog == riid )
return GetInterface((IAMErrorLog*)this, ppv);
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
}
} //namespace DESCombineLib {
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.