//+------------------------------------------------------------------+ //| Logger.mqh - Simple logging system | //| Provides info, warning, and error logging with formatting | //+------------------------------------------------------------------+ #ifndef __LOGGER_MQH__ #define __LOGGER_MQH__ #include "Config.mqh" class CLogger { private: bool m_debug_mode; public: // Constructor CLogger(bool debug_mode = true) { m_debug_mode = debug_mode; } // Log info level message void Info(const string message) { if(m_debug_mode) PrintFormat("[INFO] %s", message); } // Log warning level message void Warning(const string message) { PrintFormat("[WARNING] %s", message); } // Log error level message void Error(const string message) { PrintFormat("[ERROR] %s", message); } // Log formatted message (info level) // Note: MQL5 does not support user-defined variadic functions, so // pass an already-formatted string to this method. void InfoFormat(const string formatted) { if(m_debug_mode) { PrintFormat("[INFO] %s", formatted); } } // Log formatted message (error level) // Note: MQL5 does not support user-defined variadic functions, so // pass an already-formatted string to this method. void ErrorFormat(const string formatted) { PrintFormat("[ERROR] %s", formatted); } // Set debug mode void SetDebugMode(bool debug_mode) { m_debug_mode = debug_mode; } // Get debug mode bool GetDebugMode() const { return m_debug_mode; } }; #endif //__LOGGER_MQH__