Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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.21 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       * @return null
 021       */
 022      public function emergency($message, array $context = array())
 023      {
 024          $this->log(LogLevel::EMERGENCY, $message, $context);
 025      }
 026   
 027      /**
 028       * Action must be taken immediately.
 029       *
 030       * Example: Entire website down, database unavailable, etc. This should
 031       * trigger the SMS alerts and wake you up.
 032       *
 033       * @param string $message
 034       * @param array $context
 035       * @return null
 036       */
 037      public function alert($message, array $context = array())
 038      {
 039          $this->log(LogLevel::ALERT, $message, $context);
 040      }
 041   
 042      /**
 043       * Critical conditions.
 044       *
 045       * Example: Application component unavailable, unexpected exception.
 046       *
 047       * @param string $message
 048       * @param array $context
 049       * @return null
 050       */
 051      public function critical($message, array $context = array())
 052      {
 053          $this->log(LogLevel::CRITICAL, $message, $context);
 054      }
 055   
 056      /**
 057       * Runtime errors that do not require immediate action but should typically
 058       * be logged and monitored.
 059       *
 060       * @param string $message
 061       * @param array $context
 062       * @return null
 063       */
 064      public function error($message, array $context = array())
 065      {
 066          $this->log(LogLevel::ERROR, $message, $context);
 067      }
 068   
 069      /**
 070       * Exceptional occurrences that are not errors.
 071       *
 072       * Example: Use of deprecated APIs, poor use of an API, undesirable things
 073       * that are not necessarily wrong.
 074       *
 075       * @param string $message
 076       * @param array $context
 077       * @return null
 078       */
 079      public function warning($message, array $context = array())
 080      {
 081          $this->log(LogLevel::WARNING, $message, $context);
 082      }
 083   
 084      /**
 085       * Normal but significant events.
 086       *
 087       * @param string $message
 088       * @param array $context
 089       * @return null
 090       */
 091      public function notice($message, array $context = array())
 092      {
 093          $this->log(LogLevel::NOTICE, $message, $context);
 094      }
 095   
 096      /**
 097       * Interesting events.
 098       *
 099       * Example: User logs in, SQL logs.
 100       *
 101       * @param string $message
 102       * @param array $context
 103       * @return null
 104       */
 105      public function info($message, array $context = array())
 106      {
 107          $this->log(LogLevel::INFO, $message, $context);
 108      }
 109   
 110      /**
 111       * Detailed debug information.
 112       *
 113       * @param string $message
 114       * @param array $context
 115       * @return null
 116       */
 117      public function debug($message, array $context = array())
 118      {
 119          $this->log(LogLevel::DEBUG, $message, $context);
 120      }
 121   
 122      /**
 123       * Logs with an arbitrary level.
 124       *
 125       * @param mixed $level
 126       * @param string $message
 127       * @param array $context
 128       * @return null
 129       */
 130      abstract public function log($level, $message, array $context = array());
 131  }
 132