|
22 | 22 | * instantiated successfully by {@link LogFactory}, classes that implement |
23 | 23 | * this interface must have a constructor that takes a single String |
24 | 24 | * parameter representing the "name" of this Log. |
25 | | - * <p> |
26 | | - * The six logging levels used by <code>Log</code> are (in order): |
| 25 | + * |
| 26 | + * <p>The six logging levels used by <code>Log</code> are (in order): |
27 | 27 | * <ol> |
28 | 28 | * <li>trace (the least serious)</li> |
29 | 29 | * <li>debug</li> |
|
32 | 32 | * <li>error</li> |
33 | 33 | * <li>fatal (the most serious)</li> |
34 | 34 | * </ol> |
| 35 | + * |
35 | 36 | * The mapping of these log levels to the concepts used by the underlying |
36 | 37 | * logging system is implementation dependent. |
37 | 38 | * The implementation should ensure, though, that this ordering behaves |
38 | 39 | * as expected. |
39 | | - * <p> |
40 | | - * Performance is often a logging concern. |
| 40 | + * |
| 41 | + * <p>Performance is often a logging concern. |
41 | 42 | * By examining the appropriate property, |
42 | 43 | * a component can avoid expensive operations (producing information |
43 | 44 | * to be logged). |
44 | | - * <p> |
45 | | - * For example, |
| 45 | + * |
| 46 | + * <p>For example, |
46 | 47 | * <pre> |
47 | 48 | * if (log.isDebugEnabled()) { |
48 | 49 | * ... do something expensive ... |
49 | 50 | * log.debug(theResult); |
50 | 51 | * } |
51 | 52 | * </pre> |
52 | | - * <p> |
53 | | - * Configuration of the underlying logging system will generally be done |
| 53 | + * |
| 54 | + * <p>Configuration of the underlying logging system will generally be done |
54 | 55 | * external to the Logging APIs, through whatever mechanism is supported by |
55 | 56 | * that system. |
56 | 57 | * |
57 | | - * @version $Id: Log.java 1606045 2014-06-27 12:11:56Z tn $ |
| 58 | + * @author Juergen Hoeller (for the {@code spring-jcl} variant) |
| 59 | + * @since 5.0 |
58 | 60 | */ |
59 | 61 | public interface Log { |
60 | 62 |
|
61 | | - /** |
62 | | - * Logs a message with debug log level. |
63 | | - * |
64 | | - * @param message log this message |
65 | | - */ |
66 | | - void debug(Object message); |
67 | | - |
68 | | - /** |
69 | | - * Logs an error with debug log level. |
70 | | - * |
71 | | - * @param message log this message |
72 | | - * @param t log this cause |
73 | | - */ |
74 | | - void debug(Object message, Throwable t); |
75 | | - |
76 | | - /** |
| 63 | + /** |
| 64 | + * Is fatal logging currently enabled? |
| 65 | + * <p>Call this method to prevent having to perform expensive operations |
| 66 | + * (for example, <code>String</code> concatenation) |
| 67 | + * when the log level is more than fatal. |
| 68 | + * @return true if fatal is enabled in the underlying logger. |
| 69 | + */ |
| 70 | + boolean isFatalEnabled(); |
| 71 | + |
| 72 | + /** |
| 73 | + * Is error logging currently enabled? |
| 74 | + * <p>Call this method to prevent having to perform expensive operations |
| 75 | + * (for example, <code>String</code> concatenation) |
| 76 | + * when the log level is more than error. |
| 77 | + * @return true if error is enabled in the underlying logger. |
| 78 | + */ |
| 79 | + boolean isErrorEnabled(); |
| 80 | + |
| 81 | + /** |
| 82 | + * Is warn logging currently enabled? |
| 83 | + * <p>Call this method to prevent having to perform expensive operations |
| 84 | + * (for example, <code>String</code> concatenation) |
| 85 | + * when the log level is more than warn. |
| 86 | + * @return true if warn is enabled in the underlying logger. |
| 87 | + */ |
| 88 | + boolean isWarnEnabled(); |
| 89 | + |
| 90 | + /** |
| 91 | + * Is info logging currently enabled? |
| 92 | + * <p>Call this method to prevent having to perform expensive operations |
| 93 | + * (for example, <code>String</code> concatenation) |
| 94 | + * when the log level is more than info. |
| 95 | + * @return true if info is enabled in the underlying logger. |
| 96 | + */ |
| 97 | + boolean isInfoEnabled(); |
| 98 | + |
| 99 | + /** |
| 100 | + * Is debug logging currently enabled? |
| 101 | + * <p>Call this method to prevent having to perform expensive operations |
| 102 | + * (for example, <code>String</code> concatenation) |
| 103 | + * when the log level is more than debug. |
| 104 | + * @return true if debug is enabled in the underlying logger. |
| 105 | + */ |
| 106 | + boolean isDebugEnabled(); |
| 107 | + |
| 108 | + /** |
| 109 | + * Is trace logging currently enabled? |
| 110 | + * <p>Call this method to prevent having to perform expensive operations |
| 111 | + * (for example, <code>String</code> concatenation) |
| 112 | + * when the log level is more than trace. |
| 113 | + * @return true if trace is enabled in the underlying logger. |
| 114 | + */ |
| 115 | + boolean isTraceEnabled(); |
| 116 | + |
| 117 | + |
| 118 | + /** |
| 119 | + * Logs a message with fatal log level. |
| 120 | + * @param message log this message |
| 121 | + */ |
| 122 | + void fatal(Object message); |
| 123 | + |
| 124 | + /** |
| 125 | + * Logs an error with fatal log level. |
| 126 | + * @param message log this message |
| 127 | + * @param t log this cause |
| 128 | + */ |
| 129 | + void fatal(Object message, Throwable t); |
| 130 | + |
| 131 | + /** |
77 | 132 | * Logs a message with error log level. |
78 | | - * |
79 | 133 | * @param message log this message |
80 | 134 | */ |
81 | 135 | void error(Object message); |
82 | 136 |
|
83 | 137 | /** |
84 | 138 | * Logs an error with error log level. |
85 | | - * |
86 | 139 | * @param message log this message |
87 | 140 | * @param t log this cause |
88 | 141 | */ |
89 | 142 | void error(Object message, Throwable t); |
90 | 143 |
|
91 | | - /** |
92 | | - * Logs a message with fatal log level. |
93 | | - * |
94 | | - * @param message log this message |
95 | | - */ |
96 | | - void fatal(Object message); |
| 144 | + /** |
| 145 | + * Logs a message with warn log level. |
| 146 | + * @param message log this message |
| 147 | + */ |
| 148 | + void warn(Object message); |
97 | 149 |
|
98 | | - /** |
99 | | - * Logs an error with fatal log level. |
100 | | - * |
101 | | - * @param message log this message |
102 | | - * @param t log this cause |
103 | | - */ |
104 | | - void fatal(Object message, Throwable t); |
| 150 | + /** |
| 151 | + * Logs an error with warn log level. |
| 152 | + * @param message log this message |
| 153 | + * @param t log this cause |
| 154 | + */ |
| 155 | + void warn(Object message, Throwable t); |
105 | 156 |
|
106 | 157 | /** |
107 | 158 | * Logs a message with info log level. |
108 | | - * |
109 | 159 | * @param message log this message |
110 | 160 | */ |
111 | 161 | void info(Object message); |
112 | 162 |
|
113 | 163 | /** |
114 | 164 | * Logs an error with info log level. |
115 | | - * |
116 | 165 | * @param message log this message |
117 | 166 | * @param t log this cause |
118 | 167 | */ |
119 | 168 | void info(Object message, Throwable t); |
120 | 169 |
|
121 | | - /** |
122 | | - * Is debug logging currently enabled? |
123 | | - * <p> |
124 | | - * Call this method to prevent having to perform expensive operations |
125 | | - * (for example, <code>String</code> concatenation) |
126 | | - * when the log level is more than debug. |
127 | | - * |
128 | | - * @return true if debug is enabled in the underlying logger. |
129 | | - */ |
130 | | - boolean isDebugEnabled(); |
| 170 | + /** |
| 171 | + * Logs a message with debug log level. |
| 172 | + * @param message log this message |
| 173 | + */ |
| 174 | + void debug(Object message); |
131 | 175 |
|
132 | | - /** |
133 | | - * Is error logging currently enabled? |
134 | | - * <p> |
135 | | - * Call this method to prevent having to perform expensive operations |
136 | | - * (for example, <code>String</code> concatenation) |
137 | | - * when the log level is more than error. |
138 | | - * |
139 | | - * @return true if error is enabled in the underlying logger. |
140 | | - */ |
141 | | - boolean isErrorEnabled(); |
142 | | - |
143 | | - /** |
144 | | - * Is fatal logging currently enabled? |
145 | | - * <p> |
146 | | - * Call this method to prevent having to perform expensive operations |
147 | | - * (for example, <code>String</code> concatenation) |
148 | | - * when the log level is more than fatal. |
149 | | - * |
150 | | - * @return true if fatal is enabled in the underlying logger. |
151 | | - */ |
152 | | - boolean isFatalEnabled(); |
153 | | - |
154 | | - /** |
155 | | - * Is info logging currently enabled? |
156 | | - * <p> |
157 | | - * Call this method to prevent having to perform expensive operations |
158 | | - * (for example, <code>String</code> concatenation) |
159 | | - * when the log level is more than info. |
160 | | - * |
161 | | - * @return true if info is enabled in the underlying logger. |
162 | | - */ |
163 | | - boolean isInfoEnabled(); |
164 | | - |
165 | | - /** |
166 | | - * Is trace logging currently enabled? |
167 | | - * <p> |
168 | | - * Call this method to prevent having to perform expensive operations |
169 | | - * (for example, <code>String</code> concatenation) |
170 | | - * when the log level is more than trace. |
171 | | - * |
172 | | - * @return true if trace is enabled in the underlying logger. |
173 | | - */ |
174 | | - boolean isTraceEnabled(); |
| 176 | + /** |
| 177 | + * Logs an error with debug log level. |
| 178 | + * @param message log this message |
| 179 | + * @param t log this cause |
| 180 | + */ |
| 181 | + void debug(Object message, Throwable t); |
175 | 182 |
|
176 | | - /** |
177 | | - * Is warn logging currently enabled? |
178 | | - * <p> |
179 | | - * Call this method to prevent having to perform expensive operations |
180 | | - * (for example, <code>String</code> concatenation) |
181 | | - * when the log level is more than warn. |
182 | | - * |
183 | | - * @return true if warn is enabled in the underlying logger. |
184 | | - */ |
185 | | - boolean isWarnEnabled(); |
186 | | - |
187 | | - /** |
| 183 | + /** |
188 | 184 | * Logs a message with trace log level. |
189 | | - * |
190 | 185 | * @param message log this message |
191 | 186 | */ |
192 | 187 | void trace(Object message); |
193 | 188 |
|
194 | 189 | /** |
195 | 190 | * Logs an error with trace log level. |
196 | | - * |
197 | 191 | * @param message log this message |
198 | 192 | * @param t log this cause |
199 | 193 | */ |
200 | 194 | void trace(Object message, Throwable t); |
201 | 195 |
|
202 | | - /** |
203 | | - * Logs a message with warn log level. |
204 | | - * |
205 | | - * @param message log this message |
206 | | - */ |
207 | | - void warn(Object message); |
208 | | - |
209 | | - /** |
210 | | - * Logs an error with warn log level. |
211 | | - * |
212 | | - * @param message log this message |
213 | | - * @param t log this cause |
214 | | - */ |
215 | | - void warn(Object message, Throwable t); |
216 | 196 | } |
0 commit comments