|
#include "stdafx.h"
#include "CFuncLog.h"
//////////////////////////////////////////////////////////////////////////
//
CFuncLog::CFuncLog( CLog &pLog, const std::string &FunctionName )
{
m_pLog = &pLog;
m_strFuncName = FunctionName.c_str();
if( m_pLog != NULL )
m_pLog->LogString( 2, std::string( m_strFuncName + " enter\n" ) );
}
//////////////////////////////////////////////////////////////////////////
//
CFuncLog::CFuncLog( CLog *pLog, const std::string &FunctionName )
{
m_pLog = pLog;
m_strFuncName = FunctionName.c_str();
if( m_pLog != NULL )
m_pLog->LogString( 2, std::string( m_strFuncName + " enter\n" ) );
};
//////////////////////////////////////////////////////////////////////////
//
CFuncLog::CFuncLog( CLog *pLog, char *szFunctionName )
{
m_pLog = pLog;
m_strFuncName = szFunctionName;
if( m_pLog != NULL )
m_pLog->LogString( 2, std::string( m_strFuncName + " enter\n" ) );
}
//////////////////////////////////////////////////////////////////////////
//
CFuncLog::~CFuncLog( )
{
if( m_pLog != NULL )
m_pLog->LogString( 2, std::string( m_strFuncName + " leave\n" ) );
m_pLog = NULL;
};
//////////////////////////////////////////////////////////////////////////
//
int CFuncLog::LogString( long Level, const std::string &Message )
{
int retValue = 0;
if( m_pLog != NULL )
retValue = m_pLog->LogString( Level, ( m_strFuncName + Message.c_str() ) );
return retValue;
};
//////////////////////////////////////////////////////////////////////////
//
std::string CFuncLog::FormatString( const std::string &Format, ... )
{
va_list args;
va_start( args, Format );
std::string RetValue;
if( m_pLog != NULL )
RetValue = m_pLog->LogFormatString( Format, args );
va_end( args );
return RetValue;
}
//////////////////////////////////////////////////////////////////////////
//
CFuncLog &CFuncLog::operator<< ( int iValue )
{
m_tmpBuf[0] = 0;
_snprintf( m_tmpBuf, sizeof( m_tmpBuf ), "%i", iValue );
if( m_pLog != NULL )
m_pLog->LogRawString( m_tmpBuf );
return *this;
};
//////////////////////////////////////////////////////////////////////////
//
CFuncLog &CFuncLog::operator<< ( long lValue )
{
m_tmpBuf[0] = 0;
_snprintf( m_tmpBuf, sizeof( m_tmpBuf ), "%l", lValue );
if( m_pLog != NULL )
m_pLog->LogRawString( m_tmpBuf );
return *this;
};
//////////////////////////////////////////////////////////////////////////
//
CFuncLog &CFuncLog::operator<< ( double dValue )
{
m_tmpBuf[0] = 0;
_snprintf( m_tmpBuf, sizeof( m_tmpBuf ), "%f", dValue );
if( m_pLog != NULL )
m_pLog->LogRawString( m_tmpBuf );
return *this;
};
//////////////////////////////////////////////////////////////////////////
//
CFuncLog &CFuncLog::operator<< ( const std::string &strValue )
{
if( m_pLog != NULL )
m_pLog->LogRawString( strValue );
return *this;
};
//////////////////////////////////////////////////////////////////////////
//
CFuncLog &CFuncLog::operator<< ( char *cszValue )
{
return *this;
};
|
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.