MonologLogger::DEBUG, 'info' => MonologLogger::INFO, 'notice' => MonologLogger::NOTICE, 'warning' => MonologLogger::WARNING, 'error' => MonologLogger::ERROR, 'critical' => MonologLogger::CRITICAL, 'alert' => MonologLogger::ALERT, 'emergency' => MonologLogger::EMERGENCY, ];// a log levels ,use a log /** * Create a new log writer instance. * * @param \Monolog\Logger $monolog * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher * @return void */ public function __construct(MonologLogger $monolog, Dispatcher $dispatcher = null) { $this->monolog = $monolog;// set this monolog, set dispatcher if (isset($dispatcher)) {// determine this dispatcher $this->dispatcher = $dispatcher;// set this dispatcher } }//Create a new log writer instance. /** * Log an emergency message to the logs. * * @param string $message * @param array $context * @return void */ public function emergency($message, array $context = []) {// write log return $this->writeLog(__FUNCTION__, $message, $context); }//Log an emergency message to the logs. use function name message and context /** * Log an alert message to the logs. * * @param string $message * @param array $context * @return void */ public function alert($message, array $context = []) { return $this->writeLog(__FUNCTION__, $message, $context); }// ditto /** * Log a critical message to the logs. * * @param string $message * @param array $context * @return void */ public function critical($message, array $context = []) { return $this->writeLog(__FUNCTION__, $message, $context); }//ditto /** * Log an error message to the logs. * * @param string $message * @param array $context * @return void */ public function error($message, array $context = []) { return $this->writeLog(__FUNCTION__, $message, $context); }//ditto /** * Log a warning message to the logs. * * @param string $message * @param array $context * @return void */ public function warning($message, array $context = []) { return $this->writeLog(__FUNCTION__, $message, $context); }//ditto /** * Log a notice to the logs. * * @param string $message * @param array $context * @return void */ public function notice($message, array $context = []) { return $this->writeLog(__FUNCTION__, $message, $context); }//ditto /** * Log an informational message to the logs. * * @param string $message * @param array $context * @return void */ public function info($message, array $context = []) { return $this->writeLog(__FUNCTION__, $message, $context); }//ditto /** * Log a debug message to the logs. * * @param string $message * @param array $context * @return void */ public function debug($message, array $context = []) { return $this->writeLog(__FUNCTION__, $message, $context); }//ditto /** * Log a message to the logs. * * @param string $level * @param string $message * @param array $context * @return void */ public function log($level, $message, array $context = []) { return $this->writeLog($level, $message, $context); }//ditto /** * Dynamically pass log calls into the writer. * * @param string $level * @param string $message * @param array $context * @return void */ public function write($level, $message, array $context = []) { return $this->writeLog($level, $message, $context); }//ditto /** * Write a message to Monolog. * * @param string $level * @param string $message * @param array $context * @return void */ protected function writeLog($level, $message, $context) { $this->fireLogEvent($level, $message = $this->formatMessage($message), $context); // start event ,like fire Log Event with levels message and context // get a right message format $this->monolog->{$level}($message, $context);//use this self function }