PageRenderTime 36ms CodeModel.GetById 32ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/libraries/vendor/psr/log/Psr/Log/AbstractLogger.php

https://gitlab.com/vitaliylukin91/idea-rating
PHP | 120 lines | 37 code | 9 blank | 74 comment | 0 complexity | a57c1be541193b72d09307bb0dfb9ed2 MD5 | raw file
  1<?php
  2
  3namespace 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 */
 12abstract class AbstractLogger implements LoggerInterface
 13{
 14    /**
 15     * System is unusable.
 16     *
 17     * @param string $message
 18     * @param array $context
 19     * @return null
 20     */
 21    public function emergency($message, array $context = array())
 22    {
 23        $this->log(LogLevel::EMERGENCY, $message, $context);
 24    }
 25
 26    /**
 27     * Action must be taken immediately.
 28     *
 29     * Example: Entire website down, database unavailable, etc. This should
 30     * trigger the SMS alerts and wake you up.
 31     *
 32     * @param string $message
 33     * @param array $context
 34     * @return null
 35     */
 36    public function alert($message, array $context = array())
 37    {
 38        $this->log(LogLevel::ALERT, $message, $context);
 39    }
 40
 41    /**
 42     * Critical conditions.
 43     *
 44     * Example: Application component unavailable, unexpected exception.
 45     *
 46     * @param string $message
 47     * @param array $context
 48     * @return null
 49     */
 50    public function critical($message, array $context = array())
 51    {
 52        $this->log(LogLevel::CRITICAL, $message, $context);
 53    }
 54
 55    /**
 56     * Runtime errors that do not require immediate action but should typically
 57     * be logged and monitored.
 58     *
 59     * @param string $message
 60     * @param array $context
 61     * @return null
 62     */
 63    public function error($message, array $context = array())
 64    {
 65        $this->log(LogLevel::ERROR, $message, $context);
 66    }
 67
 68    /**
 69     * Exceptional occurrences that are not errors.
 70     *
 71     * Example: Use of deprecated APIs, poor use of an API, undesirable things
 72     * that are not necessarily wrong.
 73     *
 74     * @param string $message
 75     * @param array $context
 76     * @return null
 77     */
 78    public function warning($message, array $context = array())
 79    {
 80        $this->log(LogLevel::WARNING, $message, $context);
 81    }
 82
 83    /**
 84     * Normal but significant events.
 85     *
 86     * @param string $message
 87     * @param array $context
 88     * @return null
 89     */
 90    public function notice($message, array $context = array())
 91    {
 92        $this->log(LogLevel::NOTICE, $message, $context);
 93    }
 94
 95    /**
 96     * Interesting events.
 97     *
 98     * Example: User logs in, SQL logs.
 99     *
100     * @param string $message
101     * @param array $context
102     * @return null
103     */
104    public function info($message, array $context = array())
105    {
106        $this->log(LogLevel::INFO, $message, $context);
107    }
108
109    /**
110     * Detailed debug information.
111     *
112     * @param string $message
113     * @param array $context
114     * @return null
115     */
116    public function debug($message, array $context = array())
117    {
118        $this->log(LogLevel::DEBUG, $message, $context);
119    }
120}