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

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
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
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) {};
std::string m_path
Definition: FileLog.h:56
std::string m_backupPath
Definition: FileLog.h:57

Member Function Documentation

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.

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 m_path
Definition: FileLog.h:56
const char FILE_LOG_BACKUP_PATH[]
const Dictionary & get(const SessionID &) const
Get a dictionary for a session.
SessionSettings m_settings
Definition: FileLog.h:58
std::string getString(const std::string &, bool capitalize=false) const
Get a value as a string.
Definition: Dictionary.cpp:32
const char FILE_LOG_PATH[]
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.

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 }
std::string m_path
Definition: FileLog.h:56
std::string m_backupPath
Definition: FileLog.h:57
const char FILE_LOG_BACKUP_PATH[]
const Dictionary & get(const SessionID &) const
Get a dictionary for a session.
SessionSettings m_settings
Definition: FileLog.h:58
std::string getString(const std::string &, bool capitalize=false) const
Get a value as a string.
Definition: Dictionary.cpp:32
const char FILE_LOG_PATH[]
void FIX::FileLogFactory::destroy ( Log log)
virtual

Implements FIX::LogFactory.

Definition at line 74 of file FileLog.cpp.

References m_globalLog, and m_globalLogCount.

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

Member Data Documentation

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

Definition at line 57 of file FileLog.h.

Referenced by create().

Log* FIX::FileLogFactory::m_globalLog
private

Definition at line 59 of file FileLog.h.

Referenced by create(), and destroy().

int FIX::FileLogFactory::m_globalLogCount
private

Definition at line 60 of file FileLog.h.

Referenced by create(), and destroy().

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

Definition at line 56 of file FileLog.h.

Referenced by create().

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:

Generated on Sat Mar 29 2014 15:13:34 for QuickFIX by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2001