[Quickfix-users] DualLogFactory implementation in C# using Joerg Thoennes example
Brought to you by:
orenmnero
From: George G. <gge...@ho...> - 2005-07-22 19:48:57
|
In case somebody needs to do the same thing in C# this is how I have done it. using System; using QuickFix; namespace Utils { /// <summary> /// Summary description for DualLogFactory. /// </summary> public class DualLogFactory: QuickFix.LogFactory { private QuickFix.LogFactory lf1; private QuickFix.LogFactory lf2; public DualLogFactory( QuickFix.LogFactory lf1, QuickFix.LogFactory lf2 ) { this.lf1 = lf1; this.lf2 = lf2; } public QuickFix.Log create( SessionID sessionID ) { return new DualLog( lf1.create( sessionID ), lf2.create( sessionID ) ); } } } using System; using QuickFix; namespace Utils { /// <summary> /// Summary description for DualLog. /// </summary> public class DualLog: QuickFix.Log { QuickFix.Log l1; QuickFix.Log l2; public DualLog( QuickFix.Log l1, QuickFix.Log l2 ) { this.l1 = l1; this.l2 = l2; } public void onIncoming( String text ) { l1.onIncoming( text ); l2.onIncoming( text ); } public void onOutgoing( String text ) { l1.onOutgoing( text ); l2.onOutgoing( text ); } public void onEvent( String text ) { l1.onEvent( text ); l2.onEvent( text ); } } } //called like this from main part FileLogFactory fileLogFactory = new FileLogFactory( settings ); ScreenLogFactory screenLogFactory = new ScreenLogFactory( true, true, true ); DualLogFactory dualLogFactory = new DualLogFactory(fileLogFactory,screenLogFactory); SocketInitiator initiator = new SocketInitiator( fixApp, factory, settings, dualLogFactory, messageFactory ); _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ |