You are here

LoggerBase.php in Service Container 7

Same filename and directory in other branches
  1. 7.2 src/Logger/LoggerBase.php

File

src/Logger/LoggerBase.php
View source
<?php

/**
 * @file
 * Contains \Drupal\service_container\Logger\LoggerBase.
 */
namespace Drupal\service_container\Logger;

use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;

/**
 * Provides a common base class for loggers to reduce boilerplate code.
 */
abstract class LoggerBase implements LoggerInterface {

  /**
   * {@inheritdoc}
   */
  public function emergency($message, array $context = array()) {
    return $this
      ->log(LogLevel::EMERGENCY, $message, $context);
  }

  /**
   * {@inheritdoc}
   */
  public function alert($message, array $context = array()) {
    return $this
      ->log(LogLevel::ALERT, $message, $context);
  }

  /**
   * {@inheritdoc}
   */
  public function critical($message, array $context = array()) {
    return $this
      ->log(LogLevel::CRITICAL, $message, $context);
  }

  /**
   * {@inheritdoc}
   */
  public function error($message, array $context = array()) {
    return $this
      ->log(LogLevel::ERROR, $message, $context);
  }

  /**
   * {@inheritdoc}
   */
  public function warning($message, array $context = array()) {
    return $this
      ->log(LogLevel::WARNING, $message, $context);
  }

  /**
   * {@inheritdoc}
   */
  public function notice($message, array $context = array()) {
    return $this
      ->log(LogLevel::NOTICE, $message, $context);
  }

  /**
   * {@inheritdoc}
   */
  public function info($message, array $context = array()) {
    return $this
      ->log(LogLevel::INFO, $message, $context);
  }

  /**
   * {@inheritdoc}
   */
  public function debug($message, array $context = array()) {
    return $this
      ->log(LogLevel::DEBUG, $message, $context);
  }

}

Classes

Namesort descending Description
LoggerBase Provides a common base class for loggers to reduce boilerplate code.