Subversion Repositories spk

Rev

Rev 8 | Rev 10 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#include "log.h"

CLog *CLog::m_pInstance = 0;

CLog::CLog()
{
}

CLog::~CLog()
{
}

CLog *CLog::create()
{
        if ( !m_pInstance ) {
                m_pInstance = new CLog();
        }
        return m_pInstance;
}

void CLog::release()
{
        if ( m_pInstance ) {
                delete m_pInstance;
        }
        m_pInstance = 0;
}

void CLog::log(const Utils::String &sLogText)
{
        CLog *pLogger = CLog::create();
        pLogger->_log(sLogText);
}

void CLog::displayLog(const Utils::String &sLogText) const
{
}

void CLog::_log(const Utils::String &sLogText)
{
        m_lLogs.pushBack(sLogText, "");

        this->displayLog(sLogText);
}

void CLog::logf(const char *sLogText, ...)
{
        char buffer[10000];
        va_list args;
        va_start (args, sLogText);
        vsprintf (buffer, sLogText, args);
        va_end (args);

        CLog::log(buffer);
}
void CLog::_logf(const char *sLogText, ...)
{
        char buffer[10000];
        va_list args;
        va_start (args, sLogText);
        vsprintf (buffer, sLogText, args);
        va_end (args);

        this->_log(buffer);
}

void CLog::clear()
{
        m_lLogs.clear();
}
        
const Utils::String &CLog::firstLog() const
{
        return m_lLogs.firstStr();
}

int CLog::count() const
{
        return m_lLogs.size();
}