/** * Log a message to the logfile. * * @param string $message */ public static function log($message) { if (self::$logEnabled) { if (self::$log == null) { self::$logFile = realpath(getcwd() . '/.mage/logs') . '/log-' . date('Ymd-His') . '.log'; self::$log = fopen(self::$logFile, 'w'); } $message = date('Y-m-d H:i:s -- ') . $message; fwrite(self::$log, $message . PHP_EOL); } }