01: /*
02: * Copyright 2007 Hippo.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package nl.hippo.cms.brokenlinkchecker.log;
17:
18: import org.apache.avalon.framework.logger.Logger;
19:
20: /**
21: * <p>
22: * This logger delegates all messages to an Avalon Logkit logger.
23: * </p>
24: */
25: public class AvalonLog implements BrokenLinkCheckerLog {
26: /**
27: * <p>
28: * The Avalon Logkit logger to delegate the messages to.
29: * </p>
30: */
31: private Logger delegate;
32:
33: /**
34: * <p>
35: * Create an instance of a logger that delegates to an Avalon Logkit
36: * logger.
37: * </p>
38: *
39: * @param delegate
40: * the Avalon Logkit logger to delegate the messages to.
41: */
42: public AvalonLog(Logger delegate) {
43: super ();
44:
45: this .delegate = delegate;
46: }
47:
48: public void warning(String message, Exception cause) {
49: if (delegate.isWarnEnabled()) {
50: delegate.warn(message, cause);
51: }
52: }
53:
54: public void error(String message) {
55: if (delegate.isErrorEnabled()) {
56: delegate.error(message);
57: }
58: }
59:
60: public void error(String message, Exception cause) {
61: if (delegate.isErrorEnabled()) {
62: delegate.error(message, cause);
63: }
64: }
65: }
|