Changeset 1631

Show
Ignore:
Timestamp:
09/22/08 13:24:42 (4 months ago)
Author:
phil.booth
Message:
Reinstated the default constructor for CLog and added an appropriate initialisation method.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/LibXPort/include/LibXPort/Log.h

    r1630 r1631  
    3131                        typedef enum { ALL, DEBUG, SPECIAL } build_t; 
    3232 
     33                        CLog(); 
    3334                        CLog(const char *sFile, bool bClobber = false); 
    3435                        ~CLog(); 
    3536 
     37                        bool Init(const char *sFile, bool bClobber = false); 
    3638                        void Log(const wchar_t *sMessage, const wchar_t *Source, level_t eLevel = TRACE, build_t eCondition = ALL); 
    3739                        void LogAll(const wchar_t *sMessage, const wchar_t *sSource, level_t eLevel = TRACE); 
     
    4143 
    4244                private: 
    43                         CLog(); 
    4445                        CLog(const CLog &rhs); 
    4546                        CLog &operator=(const CLog &rhs); 
  • trunk/LibXPort/src/Log.cpp

    r1626 r1631  
    2020using namespace LibXPort; 
    2121 
     22CLog::CLog() 
     23{ 
     24} 
     25 
    2226CLog::CLog(const char *sFile, bool bClobber) 
    2327: m_f(sFile, std::ios_base::app | std::ios_base::out | (bClobber ? std::ios_base::trunc : 0)) 
     
    3135} 
    3236 
     37bool CLog::Init(const char *sFile, bool bClobber) 
     38{ 
     39        if(!m_f.is_open()) 
     40        { 
     41                m_f.open(sFile, std::ios_base::app | std::ios_base::out | (bClobber ? std::ios_base::trunc : 0)); 
     42                return m_f.is_open(); 
     43        } 
     44 
     45        return false; 
     46} 
     47 
    3348const std::wstring CLog::cm_sTrace = L"[TRACE]"; 
    3449const std::wstring CLog::cm_sWarning = L"[WARNING]";