Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 4 Libraries | FileLog

FileLog is a simple MQL4 class for flexible logging to files and the terminal console.

Github Repository: https://github.com/RGunning/MQL4Logger

Log File will be saved in:

  • <Data folder>\MQL4\Files\
  • <Data folder>\tester\files\

Usage

CFileLog* logger = new CFileLog("example.log",WARNING,true);

logger.Error(StringFormat("%s %d %s",__FILE__, __LINE__, "Something unexpected happen"));
logger.Info(StringFormat("%s %d %s",__FILE__, __LINE__, "Calculation Done));
logger.debug(StringFormat("%s %d The result of %s is %d",__FILE__, __LINE__,string1, value1));

Don't forget at the end of your EA/Indicator/Script:

Delete logger;

Log levels:

  • TRACE
  • DEBUG
  • INFO
  • WARNING
  • ERROR
  • CRITICAL

Log functions:

  • Trace()
  • Debug()
  • Info()
  • Warning()
  • Error()
  • Critical()

Example

A working example of the logger in action can be seen in FileLogExample.mq4.

Console:

MetaTrader Experts, Indicators, Scripts and Libraries

File:

MetaTrader Experts, Indicators, Scripts and Libraries

18465

Best MetaTrader Indicators + Profitable Expert Advisors