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