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 57 of file FileLog.h.

## Constructor & Destructor Documentation

## FileLogFactory() [1/3]

FIX::FileLogFactory::FileLogFactory | ( | const SessionSettings & | settings | ) |

inline

Definition at line 77 of file FileLog.h.

## FileLogFactory() [2/3]

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

inline

Definition at line 79 of file FileLog.h.

## FileLogFactory() [3/3]

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

inline

Definition at line 81 of file FileLog.h.

{ m_messages << UtcTimeStampConvertor::convert(UtcTimeStamp(), 9) << " : " << value << std::endl; }

References FIX::UtcTimeStampConvertor::convert(), FIX::FileLog::m_messages, and FIX::TYPE::UtcTimeStamp.

## Member Function Documentation

## create() [1/2]

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

virtual

Implements FIX::LogFactory.

Definition at line 47 of file FileLog.cpp.

{
m_globalLogCount--;
throw;
}
}
Log* FileLogFactory::create( const SessionID& s )
{
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 );

## create() [2/2]

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

virtual

Implements FIX::LogFactory.

Definition at line 73 of file FileLog.cpp.

{
if( pLog == m_globalLog )
{
m_globalLogCount--;
if( m_globalLogCount == 0 )
{
delete pLog;
m_globalLogCount = 0;
}
}
else
{
delete pLog;
}
}

References m_globalLog, and m_globalLogCount.

## destroy()

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

virtual

Implements FIX::LogFactory.

Definition at line 91 of file FileLog.cpp.

{
init( path, path, "GLOBAL" );
}
FileLog::FileLog( const std::string& path, const std::string& backupPath )
{
init( path, backupPath, "GLOBAL" );
}
FileLog::FileLog( const std::string& path, const SessionID& s )
{
init( path, path, generatePrefix(s) );
}
FileLog::FileLog( const std::string& path, const std::string& backupPath, const SessionID& s )

References FIX::FileLog::init().

## Member Data Documentation

## m_backupPath

std::string FIX::FileLogFactory::m_backupPath

private

Definition at line 91 of file FileLog.h.

## m_globalLog

Log* FIX::FileLogFactory::m_globalLog

private

Definition at line 93 of file FileLog.h.

Referenced by create().

## m_globalLogCount

int FIX::FileLogFactory::m_globalLogCount

private

Definition at line 94 of file FileLog.h.

Referenced by create().

## m_path

std::string FIX::FileLogFactory::m_path

private

Definition at line 90 of file FileLog.h.

## m_settings

SessionSettings FIX::FileLogFactory::m_settings

private

Definition at line 92 of file FileLog.h.

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

- FileLog.h
- FileLog.cpp

FIX::FILE_LOG_BACKUP_PATH
const char FILE_LOG_BACKUP_PATH[]
Definition: SessionSettings.h:114
FIX::Dictionary::getString
std::string getString(const std::string &, bool capitalize=false) const
Get a value as a string.
Definition: Dictionary.cpp:49
FIX::FileLogFactory::m_globalLog
Log * m_globalLog
Definition: FileLog.h:93
FIX::FileLogFactory::m_globalLogCount
int m_globalLogCount
Definition: FileLog.h:94
FIX::TYPE::UtcTimeStamp
@ UtcTimeStamp
Definition: FieldTypes.h:940
FIX::FILE_LOG_PATH
const char FILE_LOG_PATH[]
Definition: SessionSettings.h:113
FIX::UtcTimeStampConvertor::convert
static std::string convert(const UtcTimeStamp &value, int precision=0)
Definition: FieldConvertors.h:451
FIX::FileLogFactory::m_backupPath
std::string m_backupPath
Definition: FileLog.h:91
FIX::FileLogFactory::m_settings
SessionSettings m_settings
Definition: FileLog.h:92
FIX::FileLogFactory::create
Log * create()
Definition: FileLog.cpp:47
FIX::FileLog::FileLog
FileLog(const std::string &path)
Definition: FileLog.cpp:108
FIX::SessionSettings::get
const Dictionary & get(const SessionID &) const
Get a dictionary for a session.
Definition: SessionSettings.cpp:144
FIX::FileLogFactory::m_path
std::string m_path
Definition: FileLog.h:90