1: <?php
2: /**
3: * Copyright (c) 2012 PHP Framework Interoperability Group
4: *
5: * Permission is hereby granted, free of charge, to any person obtaining a copy
6: * of this software and associated documentation files (the "Software"), to deal
7: * in the Software without restriction, including without limitation the rights
8: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9: * copies of the Software, and to permit persons to whom the Software is
10: * furnished to do so, subject to the following conditions:
11: *
12: * The above copyright notice and this permission notice shall be included in
13: * all copies or substantial portions of the Software.
14: *
15: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21: */
22:
23: namespace OpenCloud\Common\Log;
24:
25: /**
26: * Describes a logger instance
27: *
28: * The message MUST be a string or object implementing __toString().
29: *
30: * The message MAY contain placeholders in the form: {foo} where foo
31: * will be replaced by the context data in key "foo".
32: *
33: * The context array can contain arbitrary data, the only assumption that
34: * can be made by implementors is that if an Exception instance is given
35: * to produce a stack trace, it MUST be in a key named "exception".
36: *
37: * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
38: * for the full interface specification.
39: */
40: interface LoggerInterface
41: {
42: /**
43: * System is unusable.
44: *
45: * @param string $message
46: * @param array $context
47: * @return null
48: */
49: public function emergency($message, array $context = array());
50:
51: /**
52: * Action must be taken immediately.
53: *
54: * Example: Entire website down, database unavailable, etc. This should
55: * trigger the SMS alerts and wake you up.
56: *
57: * @param string $message
58: * @param array $context
59: * @return null
60: */
61: public function alert($message, array $context = array());
62:
63: /**
64: * Critical conditions.
65: *
66: * Example: Application component unavailable, unexpected exception.
67: *
68: * @param string $message
69: * @param array $context
70: * @return null
71: */
72: public function critical($message, array $context = array());
73:
74: /**
75: * Runtime errors that do not require immediate action but should typically
76: * be logged and monitored.
77: *
78: * @param string $message
79: * @param array $context
80: * @return null
81: */
82: public function error($message, array $context = array());
83:
84: /**
85: * Exceptional occurrences that are not errors.
86: *
87: * Example: Use of deprecated APIs, poor use of an API, undesirable things
88: * that are not necessarily wrong.
89: *
90: * @param string $message
91: * @param array $context
92: * @return null
93: */
94: public function warning($message, array $context = array());
95:
96: /**
97: * Normal but significant events.
98: *
99: * @param string $message
100: * @param array $context
101: * @return null
102: */
103: public function notice($message, array $context = array());
104:
105: /**
106: * Interesting events.
107: *
108: * Example: User logs in, SQL logs.
109: *
110: * @param string $message
111: * @param array $context
112: * @return null
113: */
114: public function info($message, array $context = array());
115:
116: /**
117: * Detailed debug information.
118: *
119: * @param string $message
120: * @param array $context
121: * @return null
122: */
123: public function debug($message, array $context = array());
124:
125: /**
126: * Logs with an arbitrary level.
127: *
128: * @param mixed $level
129: * @param string $message
130: * @param array $context
131: * @return null
132: */
133: public function log($level, $message, array $context = array());
134: }