Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   1  <?php
   2  
   3  /*
   4   * This file is part of Mustache.php.
   5   *
   6   * (c) 2010-2017 Justin Hileman
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  /**
  13   * This is a simple Logger implementation that other Loggers can inherit from.
  14   *
  15   * This is identical to the Psr\Log\AbstractLogger.
  16   *
  17   * It simply delegates all log-level-specific methods to the `log` method to
  18   * reduce boilerplate code that a simple Logger that does the same thing with
  19   * messages regardless of the error level has to implement.
  20   */
  21  abstract class Mustache_Logger_AbstractLogger implements Mustache_Logger
  22  {
  23      /**
  24       * System is unusable.
  25       *
  26       * @param string $message
  27       * @param array  $context
  28       */
  29      public function emergency($message, array $context = array())
  30      {
  31          $this->log(Mustache_Logger::EMERGENCY, $message, $context);
  32      }
  33  
  34      /**
  35       * Action must be taken immediately.
  36       *
  37       * Example: Entire website down, database unavailable, etc. This should
  38       * trigger the SMS alerts and wake you up.
  39       *
  40       * @param string $message
  41       * @param array  $context
  42       */
  43      public function alert($message, array $context = array())
  44      {
  45          $this->log(Mustache_Logger::ALERT, $message, $context);
  46      }
  47  
  48      /**
  49       * Critical conditions.
  50       *
  51       * Example: Application component unavailable, unexpected exception.
  52       *
  53       * @param string $message
  54       * @param array  $context
  55       */
  56      public function critical($message, array $context = array())
  57      {
  58          $this->log(Mustache_Logger::CRITICAL, $message, $context);
  59      }
  60  
  61      /**
  62       * Runtime errors that do not require immediate action but should typically
  63       * be logged and monitored.
  64       *
  65       * @param string $message
  66       * @param array  $context
  67       */
  68      public function error($message, array $context = array())
  69      {
  70          $this->log(Mustache_Logger::ERROR, $message, $context);
  71      }
  72  
  73      /**
  74       * Exceptional occurrences that are not errors.
  75       *
  76       * Example: Use of deprecated APIs, poor use of an API, undesirable things
  77       * that are not necessarily wrong.
  78       *
  79       * @param string $message
  80       * @param array  $context
  81       */
  82      public function warning($message, array $context = array())
  83      {
  84          $this->log(Mustache_Logger::WARNING, $message, $context);
  85      }
  86  
  87      /**
  88       * Normal but significant events.
  89       *
  90       * @param string $message
  91       * @param array  $context
  92       */
  93      public function notice($message, array $context = array())
  94      {
  95          $this->log(Mustache_Logger::NOTICE, $message, $context);
  96      }
  97  
  98      /**
  99       * Interesting events.
 100       *
 101       * Example: User logs in, SQL logs.
 102       *
 103       * @param string $message
 104       * @param array  $context
 105       */
 106      public function info($message, array $context = array())
 107      {
 108          $this->log(Mustache_Logger::INFO, $message, $context);
 109      }
 110  
 111      /**
 112       * Detailed debug information.
 113       *
 114       * @param string $message
 115       * @param array  $context
 116       */
 117      public function debug($message, array $context = array())
 118      {
 119          $this->log(Mustache_Logger::DEBUG, $message, $context);
 120      }
 121  }