"Fossies" - the Fresh Open Source Software Archive

Member "drupal-9.4.5/vendor/psr/log/Psr/Log/AbstractLogger.php" (3 May 2021, 3104 Bytes) of package /linux/www/drupal-9.4.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

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