Log.cpp
Go to the documentation of this file.
/****************************************************************************
** Copyright (c) 2001-2014
**
** This file is part of the QuickFIX FIX Engine
**
** This file may be distributed under the terms of the quickfixengine.org
** license as defined by quickfixengine.org and appearing in the file
** LICENSE included in the packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.quickfixengine.org/LICENSE for licensing information.
**
** Contact ask@quickfixengine.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#include "config.h"
#endif
#include "Log.h"
namespace FIX
{
Mutex ScreenLog::s_mutex;
Log* ScreenLogFactory::create()
{
bool incoming, outgoing, event;
init( m_settings.get(), incoming, outgoing, event );
return new ScreenLog( incoming, outgoing, event );
}
Log* ScreenLogFactory::create( const SessionID& sessionID )
{
Dictionary settings;
if( m_settings.has(sessionID) )
settings = m_settings.get( sessionID );
bool incoming, outgoing, event;
init( settings, incoming, outgoing, event );
return new ScreenLog( sessionID, incoming, outgoing, event );
}
void ScreenLogFactory::init( const Dictionary& settings, bool& incoming, bool& outgoing, bool& event )
{
if( m_useSettings )
{
incoming = true;
outgoing = true;
event = true;
if( settings.has(SCREEN_LOG_SHOW_INCOMING) )
incoming = settings.getBool(SCREEN_LOG_SHOW_INCOMING);
if( settings.has(SCREEN_LOG_SHOW_OUTGOING) )
outgoing = settings.getBool(SCREEN_LOG_SHOW_OUTGOING);
if( settings.has(SCREEN_LOG_SHOW_EVENTS) )
event = settings.getBool(SCREEN_LOG_SHOW_EVENTS);
}
else
{
incoming = m_incoming;
outgoing = m_outgoing;
event = m_event;
}
}
void ScreenLogFactory::destroy( Log* pLog )
{
delete pLog;
}
} //namespace FIX
Log.h
FIX::Dictionary
For storage and retrieval of key/value pairs.
Definition Dictionary.h:37
FIX::Dictionary::getBool
bool getBool(const std::string &) const
Get a value as a bool.
Definition Dictionary.cpp:71
FIX::Dictionary::has
bool has(const std::string &) const
Check if the dictionary contains a value for key.
Definition Dictionary.cpp:149
FIX::Log
This interface must be implemented to log messages and events.
Definition Log.h:82
FIX::ScreenLogFactory::init
void init(const Dictionary &settings, bool &incoming, bool &outgoing, bool &event)
Definition Log.cpp:50
FIX::ScreenLogFactory::m_incoming
bool m_incoming
Definition Log.h:71
FIX::ScreenLogFactory::m_useSettings
bool m_useSettings
Definition Log.h:74
FIX::ScreenLogFactory::create
Log * create()
Definition Log.cpp:32
FIX::ScreenLogFactory::m_event
bool m_event
Definition Log.h:73
FIX::ScreenLogFactory::m_settings
SessionSettings m_settings
Definition Log.h:75
FIX::ScreenLogFactory::destroy
void destroy(Log *log)
Definition Log.cpp:73
FIX::ScreenLogFactory::m_outgoing
bool m_outgoing
Definition Log.h:72
FIX::ScreenLog
Screen based implementation of Log.
Definition Log.h:116
FIX::ScreenLog::s_mutex
static Mutex s_mutex
Definition Log.h:169
FIX::SessionID
Unique session id consists of BeginString, SenderCompID and TargetCompID.
Definition SessionID.h:31
FIX::SessionSettings::has
const bool has(const SessionID &) const
Check if session setings are present.
Definition SessionSettings.cpp:122
FIX::SessionSettings::get
const Dictionary & get(const SessionID &) const
Get a dictionary for a session.
Definition SessionSettings.cpp:127
FIX
Definition Acceptor.cpp:35
FIX::SCREEN_LOG_SHOW_EVENTS
const char SCREEN_LOG_SHOW_EVENTS[]
Definition SessionSettings.h:100
FIX::SCREEN_LOG_SHOW_OUTGOING
const char SCREEN_LOG_SHOW_OUTGOING[]
Definition SessionSettings.h:99
FIX::SCREEN_LOG_SHOW_INCOMING
const char SCREEN_LOG_SHOW_INCOMING[]
Definition SessionSettings.h:98