Log.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (c) 2001-2014
3 **
4 ** This file is part of the QuickFIX FIX Engine
5 **
6 ** This file may be distributed under the terms of the quickfixengine.org
7 ** license as defined by quickfixengine.org and appearing in the file
8 ** LICENSE included in the packaging of this file.
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 **
13 ** See http://www.quickfixengine.org/LICENSE for licensing information.
14 **
15 ** Contact ask@quickfixengine.org if any conditions of this licensing are
16 ** not clear to you.
17 **
18 ****************************************************************************/
19 
20 #ifdef _MSC_VER
21 #include "stdafx.h"
22 #else
23 #include "config.h"
24 #endif
25 
26 #include "Log.h"
27 
28 namespace FIX
29 {
30 Mutex ScreenLog::s_mutex;
31 
33 {
34  bool incoming, outgoing, event;
35  init( m_settings.get(), incoming, outgoing, event );
36  return new ScreenLog( incoming, outgoing, event );
37 }
38 
40 {
41  Dictionary settings;
42  if( m_settings.has(sessionID) )
43  settings = m_settings.get( sessionID );
44 
45  bool incoming, outgoing, event;
46  init( settings, incoming, outgoing, event );
47  return new ScreenLog( sessionID, incoming, outgoing, event );
48 }
49 
50 void ScreenLogFactory::init( const Dictionary& settings, bool& incoming, bool& outgoing, bool& event )
51 {
52  if( m_useSettings )
53  {
54  incoming = true;
55  outgoing = true;
56  event = true;
57 
58  if( settings.has(SCREEN_LOG_SHOW_INCOMING) )
59  incoming = settings.getBool(SCREEN_LOG_SHOW_INCOMING);
60  if( settings.has(SCREEN_LOG_SHOW_OUTGOING) )
61  outgoing = settings.getBool(SCREEN_LOG_SHOW_OUTGOING);
62  if( settings.has(SCREEN_LOG_SHOW_EVENTS) )
63  event = settings.getBool(SCREEN_LOG_SHOW_EVENTS);
64  }
65  else
66  {
67  incoming = m_incoming;
68  outgoing = m_outgoing;
69  event = m_event;
70  }
71 }
72 
74 {
75  delete pLog;
76 }
77 } //namespace FIX
Screen based implementation of Log.
Definition: Log.h:115
static Mutex s_mutex
Definition: Log.h:169
bool m_useSettings
Definition: Log.h:74
void destroy(Log *log)
Definition: Log.cpp:73
const bool has(const SessionID &) const
Check if session setings are present.
bool has(const std::string &) const
Check if the dictionary contains a value for key.
Definition: Dictionary.cpp:149
const Dictionary & get(const SessionID &) const
Get a dictionary for a session.
This interface must be implemented to log messages and events.
Definition: Log.h:81
void init(const Dictionary &settings, bool &incoming, bool &outgoing, bool &event)
Definition: Log.cpp:50
const char SCREEN_LOG_SHOW_OUTGOING[]
Definition: Acceptor.cpp:34
Log * create()
Definition: Log.cpp:32
const char SCREEN_LOG_SHOW_EVENTS[]
const char SCREEN_LOG_SHOW_INCOMING[]
For storage and retrieval of key/value pairs.
Definition: Dictionary.h:36
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition: SessionID.h:30
SessionSettings m_settings
Definition: Log.h:75
bool getBool(const std::string &) const
Get a value as a bool.
Definition: Dictionary.cpp:71

Generated on Sun Apr 15 2018 21:44:00 for QuickFIX by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2001