Public Member Functions | Private Attributes | List of all members
FIX::FileLogFactory Class Reference

Creates a file based implementation of Log. More...

#include <FileLog.h>

Inheritance diagram for FIX::FileLogFactory:
Inheritance graph
[legend]
Collaboration diagram for FIX::FileLogFactory:
Collaboration graph
[legend]

Public Member Functions

 FileLogFactory (const SessionSettings &settings)
 
 FileLogFactory (const std::string &path)
 
 FileLogFactory (const std::string &path, const std::string &backupPath)
 
Logcreate ()
 
Logcreate (const SessionID &)
 
void destroy (Log *log)
 
- Public Member Functions inherited from FIX::LogFactory
virtual ~LogFactory ()
 

Private Attributes

std::string m_path
 
std::string m_backupPath
 
SessionSettings m_settings
 
Logm_globalLog
 
int m_globalLogCount
 

Detailed Description

Creates a file based implementation of Log.

This stores all log events into flat files

Definition at line 40 of file FileLog.h.

Constructor & Destructor Documentation

◆ FileLogFactory() [1/3]

FIX::FileLogFactory::FileLogFactory ( const SessionSettings settings)
inline

Definition at line 43 of file FileLog.h.

44: m_settings( settings ), m_globalLog(0), m_globalLogCount(0) {};
SessionSettings m_settings
Definition FileLog.h:58

◆ FileLogFactory() [2/3]

FIX::FileLogFactory::FileLogFactory ( const std::string &  path)
inline

Definition at line 45 of file FileLog.h.

46: m_path( path ), m_backupPath( path ), m_globalLog(0), m_globalLogCount(0) {};
std::string m_path
Definition FileLog.h:56
std::string m_backupPath
Definition FileLog.h:57

◆ FileLogFactory() [3/3]

FIX::FileLogFactory::FileLogFactory ( const std::string &  path,
const std::string &  backupPath 
)
inline

Definition at line 47 of file FileLog.h.

48: m_path( path ), m_backupPath( backupPath ), m_globalLog(0), m_globalLogCount(0) {};

Member Function Documentation

◆ create() [1/2]

Log * FIX::FileLogFactory::create ( )
virtual

Implements FIX::LogFactory.

Definition at line 30 of file FileLog.cpp.

31{
33 if( m_globalLogCount > 1 ) return m_globalLog;
34
35 try
36 {
37 if ( m_path.size() ) return new FileLog( m_path );
38 std::string path;
39 std::string backupPath;
40
41 Dictionary settings = m_settings.get();
42 path = settings.getString( FILE_LOG_PATH );
43 backupPath = path;
44 if( settings.has( FILE_LOG_BACKUP_PATH ) )
45 backupPath = settings.getString( FILE_LOG_BACKUP_PATH );
46
47 return m_globalLog = new FileLog( path, backupPath );
48 }
49 catch( ConfigError& )
50 {
52 throw;
53 }
54}
std::string getString(const std::string &, bool capitalize=false) const
Get a value as a string.
const Dictionary & get(const SessionID &) const
Get a dictionary for a session.
const char FILE_LOG_PATH[]
const char FILE_LOG_BACKUP_PATH[]

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, and m_settings.

◆ create() [2/2]

Log * FIX::FileLogFactory::create ( const SessionID s)
virtual

Implements FIX::LogFactory.

Definition at line 56 of file FileLog.cpp.

57{
58 if ( m_path.size() && m_backupPath.size() )
59 return new FileLog( m_path, m_backupPath, s );
60 if ( m_path.size() )
61 return new FileLog( m_path, s );
62
63 std::string path;
64 std::string backupPath;
65 Dictionary settings = m_settings.get( s );
66 path = settings.getString( FILE_LOG_PATH );
67 backupPath = path;
68 if( settings.has( FILE_LOG_BACKUP_PATH ) )
69 backupPath = settings.getString( FILE_LOG_BACKUP_PATH );
70
71 return new FileLog( path, backupPath, s );
72}

References FIX::FILE_LOG_BACKUP_PATH, FIX::FILE_LOG_PATH, FIX::SessionSettings::get(), FIX::Dictionary::getString(), FIX::Dictionary::has(), m_backupPath, m_path, and m_settings.

◆ destroy()

void FIX::FileLogFactory::destroy ( Log log)
virtual

Implements FIX::LogFactory.

Definition at line 74 of file FileLog.cpp.

75{
76 if( pLog == m_globalLog )
77 {
79 if( m_globalLogCount == 0 )
80 {
81 delete pLog;
83 }
84 }
85 else
86 {
87 delete pLog;
88 }
89}

References m_globalLog, and m_globalLogCount.

Member Data Documentation

◆ m_backupPath

std::string FIX::FileLogFactory::m_backupPath
private

Definition at line 57 of file FileLog.h.

Referenced by create().

◆ m_globalLog

Log* FIX::FileLogFactory::m_globalLog
private

Definition at line 59 of file FileLog.h.

Referenced by create(), and destroy().

◆ m_globalLogCount

int FIX::FileLogFactory::m_globalLogCount
private

Definition at line 60 of file FileLog.h.

Referenced by create(), and destroy().

◆ m_path

std::string FIX::FileLogFactory::m_path
private

Definition at line 56 of file FileLog.h.

Referenced by create(), and create().

◆ m_settings

SessionSettings FIX::FileLogFactory::m_settings
private

Definition at line 58 of file FileLog.h.

Referenced by create(), and create().


The documentation for this class was generated from the following files:

Generated on Sun Mar 31 2024 07:07:24 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001