![]() |
Creates a file based implementation of Log. More...
#include <FileLog.h>
Public Member Functions | |
FileLogFactory (const SessionSettings &settings) | |
FileLogFactory (const std::string &path) | |
FileLogFactory (const std::string &path, const std::string &backupPath) | |
Log * | create () |
Log * | create (const SessionID &) |
void | destroy (Log *log) |
Private Attributes | |
std::string | m_path |
std::string | m_backupPath |
SessionSettings | m_settings |
Log * | m_globalLog |
int | m_globalLogCount |
Creates a file based implementation of Log.
This stores all log events into flat files
Definition at line 40 of file FileLog.h.
FIX::FileLogFactory::FileLogFactory | ( | const SessionSettings & | settings | ) | [inline] |
Definition at line 43 of file FileLog.h.
00044 : m_settings( settings ), m_globalLog(0), m_globalLogCount(0) {};
FIX::FileLogFactory::FileLogFactory | ( | const std::string & | path | ) | [inline] |
Definition at line 45 of file FileLog.h.
00046 : m_path( path ), m_backupPath( path ), m_globalLog(0), m_globalLogCount(0) {};
FIX::FileLogFactory::FileLogFactory | ( | const std::string & | path, | |
const std::string & | backupPath | |||
) | [inline] |
Definition at line 47 of file FileLog.h.
00048 : m_path( path ), m_backupPath( backupPath ), m_globalLog(0), m_globalLogCount(0) {};
Implements FIX::LogFactory.
Definition at line 60 of file FileLog.cpp.
References create(), FIX::FILE_LOG_PATH, FIX::SessionSettings::get(), FIX::Dictionary::getString(), m_backupPath, m_path, m_settings, QF_STACK_POP, and QF_STACK_PUSH.
00061 { QF_STACK_PUSH(FileLogFactory::create) 00062 00063 if ( m_path.size() && m_backupPath.size() ) 00064 return new FileLog( m_path, m_backupPath, s ); 00065 if ( m_path.size() ) 00066 return new FileLog( m_path, s ); 00067 00068 std::string path; 00069 Dictionary settings = m_settings.get( s ); 00070 path = settings.getString( FILE_LOG_PATH ); 00071 return new FileLog( path, s ); 00072 00073 QF_STACK_POP 00074 }
Log * FIX::FileLogFactory::create | ( | ) | [virtual] |
Implements FIX::LogFactory.
Definition at line 31 of file FileLog.cpp.
References FIX::FILE_LOG_BACKUP_PATH, FIX::FILE_LOG_PATH, FIX::SessionSettings::get(), FIX::Dictionary::getString(), FIX::Dictionary::has(), m_globalLog, m_globalLogCount, m_path, m_settings, QF_STACK_POP, and QF_STACK_PUSH.
Referenced by create().
00032 { QF_STACK_PUSH(FileLogFactory::create) 00033 00034 m_globalLogCount++; 00035 if( m_globalLogCount > 1 ) return m_globalLog; 00036 00037 try 00038 { 00039 if ( m_path.size() ) return new FileLog( m_path ); 00040 std::string path; 00041 std::string backupPath; 00042 00043 Dictionary settings = m_settings.get(); 00044 path = settings.getString( FILE_LOG_PATH ); 00045 backupPath = path; 00046 if( settings.has( FILE_LOG_BACKUP_PATH ) ) 00047 backupPath = settings.getString( FILE_LOG_BACKUP_PATH ); 00048 00049 return m_globalLog = new FileLog( path ); 00050 } 00051 catch( ConfigError& ) 00052 { 00053 m_globalLogCount--; 00054 throw; 00055 } 00056 00057 QF_STACK_POP 00058 }
void FIX::FileLogFactory::destroy | ( | Log * | log | ) | [virtual] |
Implements FIX::LogFactory.
Definition at line 76 of file FileLog.cpp.
References m_globalLog, m_globalLogCount, QF_STACK_POP, and QF_STACK_PUSH.
00077 { QF_STACK_PUSH(FileLogFactory::destroy) 00078 00079 if( pLog == m_globalLog ) 00080 { 00081 m_globalLogCount--; 00082 if( m_globalLogCount == 0 ) 00083 { 00084 delete pLog; 00085 m_globalLogCount = 0; 00086 } 00087 } 00088 else 00089 { 00090 delete pLog; 00091 } 00092 00093 QF_STACK_POP 00094 }
std::string FIX::FileLogFactory::m_backupPath [private] |
Log* FIX::FileLogFactory::m_globalLog [private] |
int FIX::FileLogFactory::m_globalLogCount [private] |
std::string FIX::FileLogFactory::m_path [private] |