xref: /plugin/smtp/subtree/php-fig/log/Psr/Log/LoggerInterface.php (revision ae1ee236f55bbd7fd5e41a98f6cc93dbe5a5b903)
1*ae1ee236SAndreas Gohr<?php
2*ae1ee236SAndreas Gohr
3*ae1ee236SAndreas Gohrnamespace Psr\Log;
4*ae1ee236SAndreas Gohr
5*ae1ee236SAndreas Gohr/**
6*ae1ee236SAndreas Gohr * Describes a logger instance.
7*ae1ee236SAndreas Gohr *
8*ae1ee236SAndreas Gohr * The message MUST be a string or object implementing __toString().
9*ae1ee236SAndreas Gohr *
10*ae1ee236SAndreas Gohr * The message MAY contain placeholders in the form: {foo} where foo
11*ae1ee236SAndreas Gohr * will be replaced by the context data in key "foo".
12*ae1ee236SAndreas Gohr *
13*ae1ee236SAndreas Gohr * The context array can contain arbitrary data. The only assumption that
14*ae1ee236SAndreas Gohr * can be made by implementors is that if an Exception instance is given
15*ae1ee236SAndreas Gohr * to produce a stack trace, it MUST be in a key named "exception".
16*ae1ee236SAndreas Gohr *
17*ae1ee236SAndreas Gohr * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
18*ae1ee236SAndreas Gohr * for the full interface specification.
19*ae1ee236SAndreas Gohr */
20*ae1ee236SAndreas Gohrinterface LoggerInterface
21*ae1ee236SAndreas Gohr{
22*ae1ee236SAndreas Gohr    /**
23*ae1ee236SAndreas Gohr     * System is unusable.
24*ae1ee236SAndreas Gohr     *
25*ae1ee236SAndreas Gohr     * @param string $message
26*ae1ee236SAndreas Gohr     * @param array  $context
27*ae1ee236SAndreas Gohr     *
28*ae1ee236SAndreas Gohr     * @return null
29*ae1ee236SAndreas Gohr     */
30*ae1ee236SAndreas Gohr    public function emergency($message, array $context = array());
31*ae1ee236SAndreas Gohr
32*ae1ee236SAndreas Gohr    /**
33*ae1ee236SAndreas Gohr     * Action must be taken immediately.
34*ae1ee236SAndreas Gohr     *
35*ae1ee236SAndreas Gohr     * Example: Entire website down, database unavailable, etc. This should
36*ae1ee236SAndreas Gohr     * trigger the SMS alerts and wake you up.
37*ae1ee236SAndreas Gohr     *
38*ae1ee236SAndreas Gohr     * @param string $message
39*ae1ee236SAndreas Gohr     * @param array  $context
40*ae1ee236SAndreas Gohr     *
41*ae1ee236SAndreas Gohr     * @return null
42*ae1ee236SAndreas Gohr     */
43*ae1ee236SAndreas Gohr    public function alert($message, array $context = array());
44*ae1ee236SAndreas Gohr
45*ae1ee236SAndreas Gohr    /**
46*ae1ee236SAndreas Gohr     * Critical conditions.
47*ae1ee236SAndreas Gohr     *
48*ae1ee236SAndreas Gohr     * Example: Application component unavailable, unexpected exception.
49*ae1ee236SAndreas Gohr     *
50*ae1ee236SAndreas Gohr     * @param string $message
51*ae1ee236SAndreas Gohr     * @param array  $context
52*ae1ee236SAndreas Gohr     *
53*ae1ee236SAndreas Gohr     * @return null
54*ae1ee236SAndreas Gohr     */
55*ae1ee236SAndreas Gohr    public function critical($message, array $context = array());
56*ae1ee236SAndreas Gohr
57*ae1ee236SAndreas Gohr    /**
58*ae1ee236SAndreas Gohr     * Runtime errors that do not require immediate action but should typically
59*ae1ee236SAndreas Gohr     * be logged and monitored.
60*ae1ee236SAndreas Gohr     *
61*ae1ee236SAndreas Gohr     * @param string $message
62*ae1ee236SAndreas Gohr     * @param array  $context
63*ae1ee236SAndreas Gohr     *
64*ae1ee236SAndreas Gohr     * @return null
65*ae1ee236SAndreas Gohr     */
66*ae1ee236SAndreas Gohr    public function error($message, array $context = array());
67*ae1ee236SAndreas Gohr
68*ae1ee236SAndreas Gohr    /**
69*ae1ee236SAndreas Gohr     * Exceptional occurrences that are not errors.
70*ae1ee236SAndreas Gohr     *
71*ae1ee236SAndreas Gohr     * Example: Use of deprecated APIs, poor use of an API, undesirable things
72*ae1ee236SAndreas Gohr     * that are not necessarily wrong.
73*ae1ee236SAndreas Gohr     *
74*ae1ee236SAndreas Gohr     * @param string $message
75*ae1ee236SAndreas Gohr     * @param array  $context
76*ae1ee236SAndreas Gohr     *
77*ae1ee236SAndreas Gohr     * @return null
78*ae1ee236SAndreas Gohr     */
79*ae1ee236SAndreas Gohr    public function warning($message, array $context = array());
80*ae1ee236SAndreas Gohr
81*ae1ee236SAndreas Gohr    /**
82*ae1ee236SAndreas Gohr     * Normal but significant events.
83*ae1ee236SAndreas Gohr     *
84*ae1ee236SAndreas Gohr     * @param string $message
85*ae1ee236SAndreas Gohr     * @param array  $context
86*ae1ee236SAndreas Gohr     *
87*ae1ee236SAndreas Gohr     * @return null
88*ae1ee236SAndreas Gohr     */
89*ae1ee236SAndreas Gohr    public function notice($message, array $context = array());
90*ae1ee236SAndreas Gohr
91*ae1ee236SAndreas Gohr    /**
92*ae1ee236SAndreas Gohr     * Interesting events.
93*ae1ee236SAndreas Gohr     *
94*ae1ee236SAndreas Gohr     * Example: User logs in, SQL logs.
95*ae1ee236SAndreas Gohr     *
96*ae1ee236SAndreas Gohr     * @param string $message
97*ae1ee236SAndreas Gohr     * @param array  $context
98*ae1ee236SAndreas Gohr     *
99*ae1ee236SAndreas Gohr     * @return null
100*ae1ee236SAndreas Gohr     */
101*ae1ee236SAndreas Gohr    public function info($message, array $context = array());
102*ae1ee236SAndreas Gohr
103*ae1ee236SAndreas Gohr    /**
104*ae1ee236SAndreas Gohr     * Detailed debug information.
105*ae1ee236SAndreas Gohr     *
106*ae1ee236SAndreas Gohr     * @param string $message
107*ae1ee236SAndreas Gohr     * @param array  $context
108*ae1ee236SAndreas Gohr     *
109*ae1ee236SAndreas Gohr     * @return null
110*ae1ee236SAndreas Gohr     */
111*ae1ee236SAndreas Gohr    public function debug($message, array $context = array());
112*ae1ee236SAndreas Gohr
113*ae1ee236SAndreas Gohr    /**
114*ae1ee236SAndreas Gohr     * Logs with an arbitrary level.
115*ae1ee236SAndreas Gohr     *
116*ae1ee236SAndreas Gohr     * @param mixed  $level
117*ae1ee236SAndreas Gohr     * @param string $message
118*ae1ee236SAndreas Gohr     * @param array  $context
119*ae1ee236SAndreas Gohr     *
120*ae1ee236SAndreas Gohr     * @return null
121*ae1ee236SAndreas Gohr     */
122*ae1ee236SAndreas Gohr    public function log($level, $message, array $context = array());
123*ae1ee236SAndreas Gohr}
124