Files
xMQL5/MQLTestWorkspace/Libraries/x-saherelm.log.lib.mq5
T

118 lines
1.8 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Logger Library
// ---------------------------------------
// Name: XLogger
// Description: provides Logging abilities ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
// START Inputs ...
//
input group "Logging";
input bool enableLogging = true; // Enable Logging
//
// END Inputs ...
//
//
// Including Models ...
#include "x-saherelm.models.lib.mq5"
//
// START Global Definitions: Variables, Properties and etc ...
//
string logTag = "X-Logger"; // LogTag
//
// END Global Definitions: Variables, Properties and etc ...
//
//
// START Provided Functions ...
//
//
// Logging a Message ...
void LogMessage(string message)
{
//
if (!enableLogging)
{
return;
}
//
Print(logTag, " > ", message);
}
void LogMessage(string tag, string message)
{
//
if (!enableLogging)
{
return;
}
//
Print(tag, " > ", message);
}
//
void LogEmptyLine()
{
LogMessage(" ");
}
//
// Logging an Array ...
void LogArray(int &array[])
{
//
if (!enableLogging)
{
return;
}
//
Print(logTag, ">");
ArrayPrint(array);
}
void LogArray(double &array[])
{
//
if (!enableLogging)
{
return;
}
//
Print(logTag, ">");
ArrayPrint(array);
}
void LogArray(string &array[])
{
//
if (!enableLogging)
{
return;
}
//
Print(logTag, ">");
ArrayPrint(array);
}
//
// END Provided Functions ...
//