Add a SetDebugMode method to set the desired logging level (e.g. DEBUG or INFO).
Also add an IsDebugEnabled method which simply returns a bool indicating whether debug mode is active.
Unique configuration:
In your OnInit function, call SetDebugMode only once.
Then store the result of IsDebugEnabled in a global variable, for example g_debug, for quick access.
Use in your code:
Anywhere you want to log a message, add a simple if condition that checks the global g_debug. This check is extremely fast and ensures that the StringFormat is not called unnecessarily.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Simplest Logger class for MetaTrader 5:
The simplest class for logging in MetaTrader 5 with support for levels, message format, include and exclude filters on substrings.
Author: Denis Kislicyn