KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > test > mock > avalon > MockLogger


1 /****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one *
3  * or more contributor license agreements. See the NOTICE file *
4  * distributed with this work for additional information *
5  * regarding copyright ownership. The ASF licenses this file *
6  * to you under the Apache License, Version 2.0 (the *
7  * "License"); you may not use this file except in compliance *
8  * with the License. You may obtain a copy of the License at *
9  * *
10  * http://www.apache.org/licenses/LICENSE-2.0 *
11  * *
12  * Unless required by applicable law or agreed to in writing, *
13  * software distributed under the License is distributed on an *
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
15  * KIND, either express or implied. See the License for the *
16  * specific language governing permissions and limitations *
17  * under the License. *
18  ****************************************************************/

19
20 package org.apache.james.test.mock.avalon;
21
22 import org.apache.avalon.framework.logger.Logger;
23
24 public class MockLogger implements Logger {
25     private boolean m_debugEnabled = true;
26
27     public void debug(java.lang.String JavaDoc string) {
28         System.out.println(string);
29     }
30
31     public void debug(java.lang.String JavaDoc string, java.lang.Throwable JavaDoc throwable) {
32         System.out.println(string + throwable.toString());
33         throwable.printStackTrace();
34     }
35
36     public boolean isDebugEnabled() {
37         return m_debugEnabled;
38     }
39
40     public void disableDebug() {
41         m_debugEnabled = false;
42     }
43
44     public void info(java.lang.String JavaDoc string) {
45         System.out.println(string);
46     }
47
48     public void info(java.lang.String JavaDoc string, java.lang.Throwable JavaDoc throwable) {
49         System.out.println(string + throwable.toString());
50         throwable.printStackTrace();
51     }
52
53     public boolean isInfoEnabled() {
54         return true;
55     }
56
57     public void warn(java.lang.String JavaDoc string) {
58         System.out.println(string);
59     }
60
61     public void warn(java.lang.String JavaDoc string, java.lang.Throwable JavaDoc throwable) {
62         System.out.println(string + throwable.toString());
63         throwable.printStackTrace();
64     }
65
66     public boolean isWarnEnabled() {
67         return true;
68     }
69
70     public void error(java.lang.String JavaDoc string) {
71         System.out.println(string);
72     }
73
74     public void error(java.lang.String JavaDoc string, java.lang.Throwable JavaDoc throwable) {
75         System.out.println(string + throwable.toString());
76         throwable.printStackTrace();
77     }
78
79     public boolean isErrorEnabled() {
80         return true;
81     }
82
83     public void fatalError(java.lang.String JavaDoc string) {
84         System.out.println(string);
85     }
86
87     public void fatalError(java.lang.String JavaDoc string, java.lang.Throwable JavaDoc throwable) {
88         System.out.println(string + throwable.toString());
89         throwable.printStackTrace();
90     }
91
92     public boolean isFatalErrorEnabled() {
93         return true;
94     }
95
96     public org.apache.avalon.framework.logger.Logger getChildLogger(java.lang.String JavaDoc string) {
97         return this;
98     }
99     
100 }
101
Popular Tags