/** * Handle the log message * * @see \Dialog\Log\HandlerInterface::handle() */ public function handle($level, $message) { if (!$this->shouldBeHandled($level)) { return; } // Format the message $message = $this->formatter->format(LogLevel::getLabel($level), $message); // Output/process the formatted message $this->output->output($message); }
/** * The generic log method. First verifies the log level's validity and then * interpolates and formats the message and outputs it (on the screen, in * a file, depending on the output implementation provided etc) * * @param string $level the log level * @param string $message the message * @param array $context the message's context/placeholders * @return null * * @see \Dialog\Log\LoggerInterface::log() */ public function log($level, $message, array $context = []) { // Check if level is allowed, or throw an InvalidArgumentException $this->isLevelAllowed($level); // interpolate the message $message = $this->interpolator->interpolate($message, $context); // format and add DateTimes etc $message = $this->formatter->format($level, $message); // output to the appropriate place $this->output->output($message); }