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 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.

83  { 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.

50  {
52  throw;
53  }
54 }
55 
56 Log* FileLogFactory::create( const SessionID& s )
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 );

◆ create() [2/2]

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

Implements FIX::LogFactory.

Definition at line 73 of file FileLog.cpp.

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 }

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.

92 {
93  init( path, path, "GLOBAL" );
94 }
95 
96 FileLog::FileLog( const std::string& path, const std::string& backupPath )
97 {
98  init( path, backupPath, "GLOBAL" );
99 }
100 
101 FileLog::FileLog( const std::string& path, const SessionID& s )
102 {
103  init( path, path, generatePrefix(s) );
104 }
105 
106 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:
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

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001