public function WatchdogLogger::log in Service Container 7
Same name and namespace in other branches
- 7.2 src/Logger/WatchdogLogger.php \Drupal\service_container\Logger\WatchdogLogger::log()
Logs with an arbitrary level.
Parameters
mixed $level:
string $message:
array $context:
Return value
null
Overrides LoggerInterface::log
File
- src/
Logger/ WatchdogLogger.php, line 41 - Contains \Drupal\service_container\Logger\WatchdogLogger.
Class
- WatchdogLogger
- Implements the PSR-3 logger with watchdog.
Namespace
Drupal\service_container\LoggerCode
public function log($level, $message, array $context = array()) {
$map = array(
LogLevel::EMERGENCY => WATCHDOG_EMERGENCY,
LogLevel::DEBUG => WATCHDOG_DEBUG,
LogLevel::INFO => WATCHDOG_INFO,
LogLevel::ALERT => WATCHDOG_ALERT,
LogLevel::CRITICAL => WATCHDOG_CRITICAL,
LogLevel::ERROR => WATCHDOG_ERROR,
LogLevel::NOTICE => WATCHDOG_NOTICE,
);
$watchdog_level = $map[$level];
// Map the logger channel to the watchdog type.
$type = isset($context['channel']) ? $context['channel'] : 'default';
unset($context['channel']);
$this->drupal7
->watchdog($type, $message, $context, $watchdog_level);
}