For the monitoring of trading algorithms written in S#, you can use the special
LogManager class. This class receives the
LogMessage messages from the
LogManagerSources through the
ILogSourceLog event and passes them to the
LogManagerListeners listeners. Therefore, the algorithm
code will be able to pass debug information (for example, about errors occurred during the operation, or additional information about mathematical
calculations) and LogManager will decide how to display this information for the operator.
Normally the S# contains the following implementations of the ILogListener,
whose choice affects where messages received from strategies will be passed:
- FileLogListener - writes messages into a text file. It is recommended to use for
already created algorithm, and to use the logs in cases of force majeure.
- SoundLogListener - plays the audio message when a new message arrives. It is
recommended to use if the algorithm is not under continuous monitoring.
- ConsoleLogListener - outputs messages to the console window (if the algorithm does
not have a window, it will be automatically created). It is recommended to use for debugging and testing the algorithm
- DebugLogListener - outputs messages to the debug window. This window can be viewed
through special programs such as DebugView. It is recommended to use for debugging and testing the algorithm.
- EmailLogListener - sends messages to the specified email address. It is recommended
to use if the algorithm is located at not controlled computer (at hoster’s server).
- GuiLogListener - displays messages through the special
LogWindow window. Able to work in two modes: when all messages output in a single
window, and when a separate window is created for each ILogSource.
It is recommended to use if the algorithm has a graphical interface.
LogListener can be configured to filter messages through the
Filters property. For example, through the filters you can specify what type
of messages should be processed. This is particularly useful when the SoundLogListener
or the EmailLogListener is used, in order that, for example, to send e-mail in emergency
situations only (trade algorithm error) rather than on each debug message.