Exemple #1
0
void LogSettings::MemoryInfoCollectorThread::run()
{
    while( !isStopping() )    
    {
        unsigned int toWait = 0;
        {
            common::CMutexLock lock(m_accessLock);
            toWait = m_collectMemoryIntervalMilliseconds;
        }
        
        if ( 0 == toWait )
        {
            continue;   
        }
        
        wait(toWait);

        if (!isStopping())
        {
            common::CMutexLock lock(m_accessLock);
            if ( m_pCollector!=0 )
            {
                String str = m_pCollector->collect();

                LogCategory oLogCat("MEMORY");
                rho::LogMessage oLogMsg(__FILE__, __LINE__, L_INFO, LOGCONF(), oLogCat, true );
                oLogMsg + str;

                //m_logSettings.sinkLogMessage( str );
            }            
        }        
    }
}
Exemple #2
0
void rhoPlainLogArgW(const char* file, int line, int severity, const char* szCategory,
                     const wchar_t* format, va_list ap )
{
    rho::LogMessage oLogMsg(file, line, severity, LOGCONF(), rho::LogCategory(szCategory) );

    if ( oLogMsg.isEnabled() )
    {
        rho::common::CMutexLock oLock(g_plainBufferLock);

        int buflen = sizeof(g_plainBuffer)/2-1;
        wchar_t* buf = (wchar_t*)g_plainBuffer;

        int len = vswnprintf(buf, buflen, format, ap);

        if (len < 0 || len >= buflen){
#ifdef OS_SYMBIAN
            len = buflen - 1;
#else
            len = buflen;
#endif
        }
        buf[len] = 0;

        oLogMsg + buf;
    }
}
void CNetRequestImpl::ErrorMessage(LPCTSTR pszFunction)
{ 
    // Retrieve the system error message for the last-error code
    LPTSTR pszMessage = NULL;
    DWORD dwLastError = GetLastError(); 

    DWORD dwLen = FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER | 
        //FORMAT_MESSAGE_FROM_SYSTEM |
        FORMAT_MESSAGE_FROM_HMODULE|
        FORMAT_MESSAGE_IGNORE_INSERTS,
        GetModuleHandle( _T("wininet.dll") ),
        dwLastError,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        (LPTSTR)&pszMessage,
        0, NULL );

    CAtlStringW strExtError;
    if ( dwLastError == ERROR_INTERNET_EXTENDED_ERROR )
    {
        DWORD  dwInetError =0, dwExtLength = 0;
        InternetGetLastResponseInfo( &dwInetError, NULL, &dwExtLength );

        if ( dwExtLength > 0 )
        {
            InternetGetLastResponseInfo( &dwInetError, strExtError.GetBuffer(dwExtLength+1), &dwExtLength );
            strExtError.ReleaseBuffer();
        }
    }

    rho::LogMessage oLogMsg(__FILE__, __LINE__, L_ERROR, LOGCONF(), getLogCategory() );
    oLogMsg + "Call " + pszFunction + " failed. With code : " + dwLastError;

    if ( pszMessage ) 
        oLogMsg + ".Message: " + pszMessage;
    if ( strExtError.GetLength() )
        oLogMsg + ".Extended info: " + strExtError.GetString();

    if ( pszMessage )
        LocalFree(pszMessage);
}
Exemple #4
0
void rhoPlainLogArg(const char* file, int line, LogSeverity severity, const char* szCategory,
                    const char* format, va_list ap ){
    rho::LogMessage oLogMsg(file, line, severity, LOGCONF(), rho::LogCategory(szCategory) );

    if ( oLogMsg.isEnabled() )
    {
        rho::common::CMutexLock oLock(g_plainBufferLock);

        int buflen = sizeof(g_plainBuffer)-1;
        int len = vsnprintf(g_plainBuffer, buflen, format, ap);

        if (len < 0 || len >= buflen){
#ifdef __SYMBIAN32__
            len = buflen - 1;
#else
            len = buflen;
#endif
        }
        g_plainBuffer[len] = 0;

        oLogMsg + g_plainBuffer;
    }

}