Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

LoggerTrait.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 3.28 KiB


 001  <?php
 002   
 003  namespace Psr\Log;
 004   
 005  /**
 006   * This is a simple Logger trait that classes unable to extend AbstractLogger
 007   * (because they extend another class, etc) can include.
 008   *
 009   * It simply delegates all log-level-specific methods to the `log` method to
 010   * reduce boilerplate code that a simple Logger that does the same thing with
 011   * messages regardless of the error level has to implement.
 012   */
 013  trait LoggerTrait
 014  {
 015      /**
 016       * System is unusable.
 017       *
 018       * @param string $message
 019       * @param array  $context
 020       *
 021       * @return void
 022       */
 023      public function emergency($message, array $context = array())
 024      {
 025          $this->log(LogLevel::EMERGENCY, $message, $context);
 026      }
 027   
 028      /**
 029       * Action must be taken immediately.
 030       *
 031       * Example: Entire website down, database unavailable, etc. This should
 032       * trigger the SMS alerts and wake you up.
 033       *
 034       * @param string $message
 035       * @param array  $context
 036       *
 037       * @return void
 038       */
 039      public function alert($message, array $context = array())
 040      {
 041          $this->log(LogLevel::ALERT, $message, $context);
 042      }
 043   
 044      /**
 045       * Critical conditions.
 046       *
 047       * Example: Application component unavailable, unexpected exception.
 048       *
 049       * @param string $message
 050       * @param array  $context
 051       *
 052       * @return void
 053       */
 054      public function critical($message, array $context = array())
 055      {
 056          $this->log(LogLevel::CRITICAL, $message, $context);
 057      }
 058   
 059      /**
 060       * Runtime errors that do not require immediate action but should typically
 061       * be logged and monitored.
 062       *
 063       * @param string $message
 064       * @param array  $context
 065       *
 066       * @return void
 067       */
 068      public function error($message, array $context = array())
 069      {
 070          $this->log(LogLevel::ERROR, $message, $context);
 071      }
 072   
 073      /**
 074       * Exceptional occurrences that are not errors.
 075       *
 076       * Example: Use of deprecated APIs, poor use of an API, undesirable things
 077       * that are not necessarily wrong.
 078       *
 079       * @param string $message
 080       * @param array  $context
 081       *
 082       * @return void
 083       */
 084      public function warning($message, array $context = array())
 085      {
 086          $this->log(LogLevel::WARNING, $message, $context);
 087      }
 088   
 089      /**
 090       * Normal but significant events.
 091       *
 092       * @param string $message
 093       * @param array  $context
 094       *
 095       * @return void
 096       */
 097      public function notice($message, array $context = array())
 098      {
 099          $this->log(LogLevel::NOTICE, $message, $context);
 100      }
 101   
 102      /**
 103       * Interesting events.
 104       *
 105       * Example: User logs in, SQL logs.
 106       *
 107       * @param string $message
 108       * @param array  $context
 109       *
 110       * @return void
 111       */
 112      public function info($message, array $context = array())
 113      {
 114          $this->log(LogLevel::INFO, $message, $context);
 115      }
 116   
 117      /**
 118       * Detailed debug information.
 119       *
 120       * @param string $message
 121       * @param array  $context
 122       *
 123       * @return void
 124       */
 125      public function debug($message, array $context = array())
 126      {
 127          $this->log(LogLevel::DEBUG, $message, $context);
 128      }
 129   
 130      /**
 131       * Logs with an arbitrary level.
 132       *
 133       * @param mixed  $level
 134       * @param string $message
 135       * @param array  $context
 136       *
 137       * @return void
 138       */
 139      abstract public function log($level, $message, array $context = array());
 140  }
 141