/** * Create an instance of the Logger class * * @return \Logger\Logger */ public static function makeOne(array $streams = []) { $logger = new Logger(new MonologLogger('crunz')); // Adding stream for normal output foreach ($streams as $stream => $file) { if (!$file) { continue; } $logger->addStream($file, $stream, false); } return $logger; }
/** * Handle errors * * @param \Crunz\Event $event */ protected function handleError(Event $event) { if ($this->config('log_errors')) { $this->logger->error($this->formatEventError($event)); } else { $this->display($event->getProcess()->getErrorOutput()); } // Send error as email as configured if ($this->config('email_errors')) { $this->mailer->send('Crunz: reporting error for event:' . ($event->description ? $event->description : $event->getId()), $this->formatEventError($event)); } }