"{$LOG_PATH}/cp.log", // Base log name 'logLevel' => \Monolog\Logger::DEBUG, 'maxFiles' => $maxFiles, ]; } // Use RotatingFileHandler for automatic rotation $this->pushHandler(new RotatingFileHandler($config['logFile'], $config['maxFiles'], $config['logLevel'])); } /** * @param string $key * @param null $config * @return mixed */ public static function getInstance($key = "app", $config = null) { if (empty(self::$loggers[$key])) { self::$loggers[$key] = new Logger($key, $config); } return self::$loggers[$key]; } /** * Output error based on environment */ public static function systemLogs($enable = true) { if ($enable) { // Output pretty HTML error self::htmlError(); } else { // Register system errors to rotating log file $logger = new Logger('errors'); // Key 'errors' remains for compatibility ErrorHandler::register($logger); } } /** * Display pretty HTML formatted errors during development */ public static function htmlError() { $run = new Run(); $run->pushHandler(new PrettyPageHandler()); $run->register(); } }