Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Jingga
4 *
5 * PHP Version 8.1
6 *
7 * @package   phpOMS\Log
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15namespace phpOMS\Log;
16
17/**
18 * Logging interface.
19 *
20 * @package phpOMS\Log
21 * @license OMS License 2.0
22 * @link    https://jingga.app
23 * @since   1.0.0
24 */
25interface LoggerInterface
26{
27    /**
28     * System is unusable.
29     *
30     * @param string                                    $message Logging message schema
31     * @param array<string, null|int|bool|float|string> $context Context to log
32     *
33     * @return void
34     */
35    public function emergency(string $message, array $context = []) : void;
36
37    /**
38     * Action must be taken immediately.
39     *
40     * Example: Entire website down, database unavailable, etc. This should
41     * trigger the SMS alerts and wake you up.
42     *
43     * @param string                                    $message Logging message schema
44     * @param array<string, null|int|bool|float|string> $context Context to log
45     *
46     * @return void
47     */
48    public function alert(string $message, array $context = []) : void;
49
50    /**
51     * Critical conditions.
52     *
53     * Example: Application component unavailable, unexpected exception.
54     *
55     * @param string                                    $message Logging message schema
56     * @param array<string, null|int|bool|float|string> $context Context to log
57     *
58     * @return void
59     */
60    public function critical(string $message, array $context = []) : void;
61
62    /**
63     * Runtime errors that do not require immediate action but should typically
64     * be logged and monitored.
65     *
66     * @param string                                    $message Logging message schema
67     * @param array<string, null|int|bool|float|string> $context Context to log
68     *
69     * @return void
70     */
71    public function error(string $message, array $context = []) : void;
72
73    /**
74     * Exceptional occurrences that are not errors.
75     *
76     * Example: Use of deprecated APIs, poor use of an API, undesirable things
77     * that are not necessarily wrong.
78     *
79     * @param string                                    $message Logging message schema
80     * @param array<string, null|int|bool|float|string> $context Context to log
81     *
82     * @return void
83     */
84    public function warning(string $message, array $context = []) : void;
85
86    /**
87     * Normal but significant events.
88     *
89     * @param string                                    $message Logging message schema
90     * @param array<string, null|int|bool|float|string> $context Context to log
91     *
92     * @return void
93     */
94    public function notice(string $message, array $context = []) : void;
95
96    /**
97     * Interesting events.
98     *
99     * Example: User logs in, SQL logs.
100     *
101     * @param string                                    $message Logging message schema
102     * @param array<string, null|int|bool|float|string> $context Context to log
103     *
104     * @return void
105     */
106    public function info(string $message, array $context = []) : void;
107
108    /**
109     * Detailed debug information.
110     *
111     * @param string                                    $message Logging message schema
112     * @param array<string, null|int|bool|float|string> $context Context to log
113     *
114     * @return void
115     */
116    public function debug(string $message, array $context = []) : void;
117
118    /**
119     * Logs with an arbitrary level.
120     *
121     * @param string                                    $level   Log level/severeness
122     * @param string                                    $message Logging message schema
123     * @param array<string, null|int|bool|float|string> $context Context to log
124     *
125     * @return void
126     */
127    public function log(string $level, string $message, array $context = []) : void;
128}