FIX::FileLogFactory Class Reference

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

`#include <FileLog.h>`

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

## 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)
Public Member Functions inherited from FIX::LogFactory
virtual | ~LogFactory ()

## Private Attributes

std::string | m_path
std::string | m_backupPath
SessionSettings | m_settings
Log * | m_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.

: m_settings( settings ), m_globalLog(0), m_globalLogCount(0) {};
FIX::FileLogFactory::m_globalLogCount
int m_globalLogCount
Definition: FileLog.h:60
FIX::FileLogFactory::m_settings
SessionSettings m_settings
Definition: FileLog.h:58
FIX::FileLogFactory::m_globalLog
Log * m_globalLog
Definition: FileLog.h:59

## FileLogFactory() [2/3]

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

inline

Definition at line 45 of file FileLog.h.

: m_path( path ), m_backupPath( path ), m_globalLog(0), m_globalLogCount(0) {};
FIX::FileLogFactory::m_path
std::string m_path
Definition: FileLog.h:56
FIX::FileLogFactory::m_globalLogCount
int m_globalLogCount
Definition: FileLog.h:60
FIX::FileLogFactory::m_backupPath
std::string m_backupPath
Definition: FileLog.h:57
FIX::FileLogFactory::m_globalLog
Log * m_globalLog
Definition: FileLog.h:59

## FileLogFactory() [3/3]

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

inline

Definition at line 47 of file FileLog.h.

References create(), and destroy().

: m_path( path ), m_backupPath( backupPath ), m_globalLog(0), m_globalLogCount(0) {};
FIX::FileLogFactory::m_path
std::string m_path
Definition: FileLog.h:56
FIX::FileLogFactory::m_globalLogCount
int m_globalLogCount
Definition: FileLog.h:60
FIX::FileLogFactory::m_backupPath
std::string m_backupPath
Definition: FileLog.h:57
FIX::FileLogFactory::m_globalLog
Log * m_globalLog
Definition: FileLog.h:59

## Member Function Documentation

## create() [1/2]

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

virtual

Implements FIX::LogFactory.

Definition at line 30 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, and m_settings.

Referenced by FileLogFactory().

{
m_globalLogCount++;
if( m_globalLogCount > 1 ) return m_globalLog;
try
{
if ( m_path.size() ) return new FileLog( m_path );
std::string path;
std::string backupPath;
Dictionary settings = m_settings.get();
path = settings.getString( FILE_LOG_PATH );
backupPath = path;
if( settings.has( FILE_LOG_BACKUP_PATH ) )
backupPath = settings.getString( FILE_LOG_BACKUP_PATH );
return m_globalLog = new FileLog( path, backupPath );
}
catch( ConfigError& )
{
m_globalLogCount--;
throw;
}
}
FIX::FileLogFactory::m_path
std::string m_path
Definition: FileLog.h:56
FIX::FileLogFactory::m_globalLogCount
int m_globalLogCount
Definition: FileLog.h:60
FIX::FILE_LOG_BACKUP_PATH
const char FILE_LOG_BACKUP_PATH[]
Definition: SessionSettings.h:93
FIX::SessionSettings::get
const Dictionary & get(const SessionID &) const
Get a dictionary for a session.
Definition: SessionSettings.cpp:125
FIX::FileLogFactory::m_settings
SessionSettings m_settings
Definition: FileLog.h:58
FIX::Dictionary::getString
std::string getString(const std::string &, bool capitalize=false) const
Get a value as a string.
Definition: Dictionary.cpp:32
FIX::FILE_LOG_PATH
const char FILE_LOG_PATH[]
Definition: SessionSettings.h:92
FIX::FileLogFactory::m_globalLog
Log * m_globalLog
Definition: FileLog.h:59

## create() [2/2]

Log * FIX::FileLogFactory::create | ( | const SessionID & | s | ) |

virtual

Implements FIX::LogFactory.

Definition at line 56 of file FileLog.cpp.

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.

{
if ( m_path.size() && m_backupPath.size() )
return new FileLog( m_path, m_backupPath, s );
if ( m_path.size() )
return new FileLog( m_path, s );
std::string path;
std::string backupPath;
Dictionary settings = m_settings.get( s );
path = settings.getString( FILE_LOG_PATH );
backupPath = path;
if( settings.has( FILE_LOG_BACKUP_PATH ) )
backupPath = settings.getString( FILE_LOG_BACKUP_PATH );
return new FileLog( path, backupPath, s );
}
FIX::FileLogFactory::m_path
std::string m_path
Definition: FileLog.h:56
FIX::FileLogFactory::m_backupPath
std::string m_backupPath
Definition: FileLog.h:57
FIX::FILE_LOG_BACKUP_PATH
const char FILE_LOG_BACKUP_PATH[]
Definition: SessionSettings.h:93
FIX::SessionSettings::get
const Dictionary & get(const SessionID &) const
Get a dictionary for a session.
Definition: SessionSettings.cpp:125
FIX::FileLogFactory::m_settings
SessionSettings m_settings
Definition: FileLog.h:58
FIX::Dictionary::getString
std::string getString(const std::string &, bool capitalize=false) const
Get a value as a string.
Definition: Dictionary.cpp:32
FIX::FILE_LOG_PATH
const char FILE_LOG_PATH[]
Definition: SessionSettings.h:92

## destroy()

void FIX::FileLogFactory::destroy | ( | Log * | log | ) |

virtual

Implements FIX::LogFactory.

Definition at line 74 of file FileLog.cpp.

References m_globalLog, and m_globalLogCount.

Referenced by FileLogFactory().

{
if( pLog == m_globalLog )
{
m_globalLogCount--;
if( m_globalLogCount == 0 )
{
delete pLog;
m_globalLogCount = 0;
}
}
else
{
delete pLog;
}
}
FIX::FileLogFactory::m_globalLogCount
int m_globalLogCount
Definition: FileLog.h:60
FIX::FileLogFactory::m_globalLog
Log * m_globalLog
Definition: FileLog.h:59

## 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().

## m_settings

SessionSettings FIX::FileLogFactory::m_settings

private

Definition at line 58 of file FileLog.h.

Referenced by create().

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

- FileLog.h
- FileLog.cpp