|
|
@@ -1,128 +1,128 @@
|
|
|
-<?pp
|
|
|
+<?php
|
|
|
|
|
|
-aespaePs\Log;
|
|
|
+namespace Psr\Log;
|
|
|
|
|
|
/**
|
|
|
-*ssaspleLoggepleeaoaoeLoggesaeo.
|
|
|
-*
|
|
|
-*splydelegaesalllog-level-speeodsoe`log`eodo
|
|
|
-*edueboleplaeodeaaspleLoggeadoesesaegw
|
|
|
-*essagesegadlessoeeolevelasoplee.
|
|
|
-*/
|
|
|
-absalassAbsaLoggepleesLoggeeae
|
|
|
+ * This is a simple Logger implementation that other Loggers can inherit from.
|
|
|
+ *
|
|
|
+ * It simply delegates all log-level-specific methods to the `log` method to
|
|
|
+ * reduce boilerplate code that a simple Logger that does the same thing with
|
|
|
+ * messages regardless of the error level has to implement.
|
|
|
+ */
|
|
|
+abstract class AbstractLogger implements LoggerInterface
|
|
|
{
|
|
|
-/**
|
|
|
-*Sysesuusable.
|
|
|
-*
|
|
|
-*@paasg$essage
|
|
|
-*@paaaay$oe
|
|
|
-*
|
|
|
-*@euvod
|
|
|
-*/
|
|
|
-publuoeegey($essage,aay$oe=aay())
|
|
|
-{
|
|
|
-$s->log(LogLevel::EEGEY,$essage,$oe);
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * System is unusable.
|
|
|
+ *
|
|
|
+ * @param string $message
|
|
|
+ * @param array $context
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function emergency($message, array $context = array())
|
|
|
+ {
|
|
|
+ $this->log(LogLevel::EMERGENCY, $message, $context);
|
|
|
+ }
|
|
|
|
|
|
-/**
|
|
|
-*Aousbeaeedaely.
|
|
|
-*
|
|
|
-*Eaple:Eewebsedow,daabaseuavalable,e.ssould
|
|
|
-*ggeeSSalesadwaeyouup.
|
|
|
-*
|
|
|
-*@paasg$essage
|
|
|
-*@paaaay$oe
|
|
|
-*
|
|
|
-*@euvod
|
|
|
-*/
|
|
|
-publuoale($essage,aay$oe=aay())
|
|
|
-{
|
|
|
-$s->log(LogLevel::ALE,$essage,$oe);
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * Action must be taken immediately.
|
|
|
+ *
|
|
|
+ * Example: Entire website down, database unavailable, etc. This should
|
|
|
+ * trigger the SMS alerts and wake you up.
|
|
|
+ *
|
|
|
+ * @param string $message
|
|
|
+ * @param array $context
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function alert($message, array $context = array())
|
|
|
+ {
|
|
|
+ $this->log(LogLevel::ALERT, $message, $context);
|
|
|
+ }
|
|
|
|
|
|
-/**
|
|
|
-*alodos.
|
|
|
-*
|
|
|
-*Eaple:Applaoopoeuavalable,uepeedeepo.
|
|
|
-*
|
|
|
-*@paasg$essage
|
|
|
-*@paaaay$oe
|
|
|
-*
|
|
|
-*@euvod
|
|
|
-*/
|
|
|
-publuoal($essage,aay$oe=aay())
|
|
|
-{
|
|
|
-$s->log(LogLevel::AL,$essage,$oe);
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * Critical conditions.
|
|
|
+ *
|
|
|
+ * Example: Application component unavailable, unexpected exception.
|
|
|
+ *
|
|
|
+ * @param string $message
|
|
|
+ * @param array $context
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function critical($message, array $context = array())
|
|
|
+ {
|
|
|
+ $this->log(LogLevel::CRITICAL, $message, $context);
|
|
|
+ }
|
|
|
|
|
|
-/**
|
|
|
-*ueeosadooequeedaeaobusouldypally
|
|
|
-*beloggedadooed.
|
|
|
-*
|
|
|
-*@paasg$essage
|
|
|
-*@paaaay$oe
|
|
|
-*
|
|
|
-*@euvod
|
|
|
-*/
|
|
|
-publuoeo($essage,aay$oe=aay())
|
|
|
-{
|
|
|
-$s->log(LogLevel::EO,$essage,$oe);
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * Runtime errors that do not require immediate action but should typically
|
|
|
+ * be logged and monitored.
|
|
|
+ *
|
|
|
+ * @param string $message
|
|
|
+ * @param array $context
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function error($message, array $context = array())
|
|
|
+ {
|
|
|
+ $this->log(LogLevel::ERROR, $message, $context);
|
|
|
+ }
|
|
|
|
|
|
-/**
|
|
|
-*Eepoaloueesaaeoeos.
|
|
|
-*
|
|
|
-*Eaple:UseodepeaedAPs,poouseoaAP,udesablegs
|
|
|
-*aaeoeessalywog.
|
|
|
-*
|
|
|
-*@paasg$essage
|
|
|
-*@paaaay$oe
|
|
|
-*
|
|
|
-*@euvod
|
|
|
-*/
|
|
|
-publuowag($essage,aay$oe=aay())
|
|
|
-{
|
|
|
-$s->log(LogLevel::WAG,$essage,$oe);
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * Exceptional occurrences that are not errors.
|
|
|
+ *
|
|
|
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
|
|
|
+ * that are not necessarily wrong.
|
|
|
+ *
|
|
|
+ * @param string $message
|
|
|
+ * @param array $context
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function warning($message, array $context = array())
|
|
|
+ {
|
|
|
+ $this->log(LogLevel::WARNING, $message, $context);
|
|
|
+ }
|
|
|
|
|
|
-/**
|
|
|
-*oalbusgaeves.
|
|
|
-*
|
|
|
-*@paasg$essage
|
|
|
-*@paaaay$oe
|
|
|
-*
|
|
|
-*@euvod
|
|
|
-*/
|
|
|
-publuooe($essage,aay$oe=aay())
|
|
|
-{
|
|
|
-$s->log(LogLevel::OE,$essage,$oe);
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * Normal but significant events.
|
|
|
+ *
|
|
|
+ * @param string $message
|
|
|
+ * @param array $context
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function notice($message, array $context = array())
|
|
|
+ {
|
|
|
+ $this->log(LogLevel::NOTICE, $message, $context);
|
|
|
+ }
|
|
|
|
|
|
-/**
|
|
|
-*eesgeves.
|
|
|
-*
|
|
|
-*Eaple:Uselogs,SQLlogs.
|
|
|
-*
|
|
|
-*@paasg$essage
|
|
|
-*@paaaay$oe
|
|
|
-*
|
|
|
-*@euvod
|
|
|
-*/
|
|
|
-publuoo($essage,aay$oe=aay())
|
|
|
-{
|
|
|
-$s->log(LogLevel::O,$essage,$oe);
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * Interesting events.
|
|
|
+ *
|
|
|
+ * Example: User logs in, SQL logs.
|
|
|
+ *
|
|
|
+ * @param string $message
|
|
|
+ * @param array $context
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function info($message, array $context = array())
|
|
|
+ {
|
|
|
+ $this->log(LogLevel::INFO, $message, $context);
|
|
|
+ }
|
|
|
|
|
|
-/**
|
|
|
-*Dealeddebugoao.
|
|
|
-*
|
|
|
-*@paasg$essage
|
|
|
-*@paaaay$oe
|
|
|
-*
|
|
|
-*@euvod
|
|
|
-*/
|
|
|
-publuodebug($essage,aay$oe=aay())
|
|
|
-{
|
|
|
-$s->log(LogLevel::DEBUG,$essage,$oe);
|
|
|
-}
|
|
|
+ /**
|
|
|
+ * Detailed debug information.
|
|
|
+ *
|
|
|
+ * @param string $message
|
|
|
+ * @param array $context
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function debug($message, array $context = array())
|
|
|
+ {
|
|
|
+ $this->log(LogLevel::DEBUG, $message, $context);
|
|
|
+ }
|
|
|
}
|