Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   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   * Describes a Mustache logger instance.
  14   *
  15   * This is identical to the Psr\Log\LoggerInterface.
  16   *
  17   * The message MUST be a string or object implementing __toString().
  18   *
  19   * The message MAY contain placeholders in the form: {foo} where foo
  20   * will be replaced by the context data in key "foo".
  21   *
  22   * The context array can contain arbitrary data, the only assumption that
  23   * can be made by implementors is that if an Exception instance is given
  24   * to produce a stack trace, it MUST be in a key named "exception".
  25   *
  26   * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
  27   * for the full interface specification.
  28   */
  29  interface Mustache_Logger
  30  {
  31      /**
  32       * Psr\Log compatible log levels.
  33       */
  34      const EMERGENCY = 'emergency';
  35      const ALERT     = 'alert';
  36      const CRITICAL  = 'critical';
  37      const ERROR     = 'error';
  38      const WARNING   = 'warning';
  39      const NOTICE    = 'notice';
  40      const INFO      = 'info';
  41      const DEBUG     = 'debug';
  42  
  43      /**
  44       * System is unusable.
  45       *
  46       * @param string $message
  47       * @param array  $context
  48       */
  49      public function emergency($message, array $context = array());
  50  
  51      /**
  52       * Action must be taken immediately.
  53       *
  54       * Example: Entire website down, database unavailable, etc. This should
  55       * trigger the SMS alerts and wake you up.
  56       *
  57       * @param string $message
  58       * @param array  $context
  59       */
  60      public function alert($message, array $context = array());
  61  
  62      /**
  63       * Critical conditions.
  64       *
  65       * Example: Application component unavailable, unexpected exception.
  66       *
  67       * @param string $message
  68       * @param array  $context
  69       */
  70      public function critical($message, array $context = array());
  71  
  72      /**
  73       * Runtime errors that do not require immediate action but should typically
  74       * be logged and monitored.
  75       *
  76       * @param string $message
  77       * @param array  $context
  78       */
  79      public function error($message, array $context = array());
  80  
  81      /**
  82       * Exceptional occurrences that are not errors.
  83       *
  84       * Example: Use of deprecated APIs, poor use of an API, undesirable things
  85       * that are not necessarily wrong.
  86       *
  87       * @param string $message
  88       * @param array  $context
  89       */
  90      public function warning($message, array $context = array());
  91  
  92      /**
  93       * Normal but significant events.
  94       *
  95       * @param string $message
  96       * @param array  $context
  97       */
  98      public function notice($message, array $context = array());
  99  
 100      /**
 101       * Interesting events.
 102       *
 103       * Example: User logs in, SQL logs.
 104       *
 105       * @param string $message
 106       * @param array  $context
 107       */
 108      public function info($message, array $context = array());
 109  
 110      /**
 111       * Detailed debug information.
 112       *
 113       * @param string $message
 114       * @param array  $context
 115       */
 116      public function debug($message, array $context = array());
 117  
 118      /**
 119       * Logs with an arbitrary level.
 120       *
 121       * @param mixed  $level
 122       * @param string $message
 123       * @param array  $context
 124       */
 125      public function log($level, $message, array $context = array());
 126  }