![]() |
![]() |
|
Index
Source Files
Annotated Class List
Alphabetical Class List
Class Hierarchy
Graphical Class Hierarchy
|
||
![]() |
![]() |
00001 /* -*- C++ -*- */ 00002 00003 /**************************************************************************** 00004 ** Copyright (c) quickfixengine.org All rights reserved. 00005 ** 00006 ** This file is part of the QuickFIX FIX Engine 00007 ** 00008 ** This file may be distributed under the terms of the quickfixengine.org 00009 ** license as defined by quickfixengine.org and appearing in the file 00010 ** LICENSE included in the packaging of this file. 00011 ** 00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00014 ** 00015 ** See http://www.quickfixengine.org/LICENSE for licensing information. 00016 ** 00017 ** Contact ask@quickfixengine.org if any conditions of this licensing are 00018 ** not clear to you. 00019 ** 00020 ****************************************************************************/ 00021 00022 #ifndef FIX_FILELOG_H 00023 #define FIX_FILELOG_H 00024 00025 #ifdef _MSC_VER 00026 #pragma warning( disable : 4503 4355 4786 4290 ) 00027 #endif 00028 00029 #include "Log.h" 00030 #include "SessionSettings.h" 00031 #include <fstream> 00032 00033 namespace FIX 00034 { 00040 class FileLogFactory : public LogFactory 00041 { 00042 public: 00043 FileLogFactory( const SessionSettings& settings ) 00044 : m_settings( settings ), m_globalLog(0), m_globalLogCount(0) {}; 00045 FileLogFactory( const std::string& path ) 00046 : m_path( path ), m_globalLog(0), m_globalLogCount(0) {}; 00047 00048 public: 00049 Log* create(); 00050 Log* create( const SessionID& ); 00051 void destroy( Log* log ); 00052 00053 private: 00054 std::string m_path; 00055 SessionSettings m_settings; 00056 Log* m_globalLog; 00057 int m_globalLogCount; 00058 }; 00059 00073 class FileLog : public Log 00074 { 00075 public: 00076 FileLog( const std::string& path ); 00077 FileLog( const std::string& path, const SessionID& sessionID ); 00078 virtual ~FileLog(); 00079 00080 void clear(); 00081 00082 void onIncoming( const std::string& value ) 00083 { m_messages << value << std::endl << std::flush; } 00084 void onOutgoing( const std::string& value ) 00085 { m_messages << value << std::endl << std::flush; } 00086 void onEvent( const std::string& value ) 00087 { 00088 UtcTimeStamp now; 00089 m_event << UtcTimeStampConvertor::convert( now ) 00090 << " : " << value << std::endl << std::flush; 00091 } 00092 00093 private: 00094 void init( std::string path, const std::string& prefix ); 00095 00096 std::ofstream m_messages; 00097 std::ofstream m_event; 00098 std::string m_messagesFileName; 00099 std::string m_eventFileName; 00100 }; 00101 } 00102 00103 #endif //FIX_LOG_H
1.3.6-20040222 written by Dimitri van Heesch,
© 1997-2001