KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > vfs > VfsLog


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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 org.apache.commons.vfs;
17
18 import org.apache.commons.logging.Log;
19
20 /**
21  * This class is to keep the old logging behaviour (for ant-task) and to be able to
22  * correctly use commons-logging.<br>
23  * I hope i could remove it sometimes.
24  *
25  * @author <a HREF="mailto:imario@apache.org">Mario Ivankovits</a>
26  */

27 public class VfsLog
28 {
29     // static utility class
30
private VfsLog()
31     {
32     }
33
34     /**
35      * warning
36      */

37     public static void warn(Log vfslog, Log commonslog, String JavaDoc message, Throwable JavaDoc t)
38     {
39         if (vfslog != null)
40         {
41             vfslog.warn(message, t);
42         }
43         else if (commonslog != null)
44         {
45             commonslog.warn(message, t);
46         }
47     }
48
49     /**
50      * warning
51      */

52     public static void warn(Log vfslog, Log commonslog, String JavaDoc message)
53     {
54         if (vfslog != null)
55         {
56             vfslog.warn(message);
57         }
58         else if (commonslog != null)
59         {
60             commonslog.warn(message);
61         }
62     }
63
64     /**
65      * debug
66      */

67     public static void debug(Log vfslog, Log commonslog, String JavaDoc message)
68     {
69         if (vfslog != null)
70         {
71             vfslog.debug(message);
72         }
73         else if (commonslog != null)
74         {
75             commonslog.debug(message);
76         }
77     }
78
79     /**
80      * debug
81      */

82     public static void debug(Log vfslog, Log commonslog, String JavaDoc message, Throwable JavaDoc t)
83     {
84         if (vfslog != null)
85         {
86             vfslog.debug(message, t);
87         }
88         else if (commonslog != null)
89         {
90             commonslog.debug(message, t);
91         }
92     }
93
94     /**
95      * info
96      */

97     public static void info(Log vfslog, Log commonslog, String JavaDoc message, Throwable JavaDoc t)
98     {
99         if (vfslog != null)
100         {
101             vfslog.info(message, t);
102         }
103         else if (commonslog != null)
104         {
105             commonslog.info(message, t);
106         }
107     }
108
109     /**
110      * info
111      */

112     public static void info(Log vfslog, Log commonslog, String JavaDoc message)
113     {
114         if (vfslog != null)
115         {
116             vfslog.info(message);
117         }
118         else if (commonslog != null)
119         {
120             commonslog.info(message);
121         }
122     }
123
124     /**
125      * error
126      */

127     public static void error(Log vfslog, Log commonslog, String JavaDoc message, Throwable JavaDoc t)
128     {
129         if (vfslog != null)
130         {
131             vfslog.error(message, t);
132         }
133         else if (commonslog != null)
134         {
135             commonslog.error(message, t);
136         }
137     }
138
139     /**
140      * error
141      */

142     public static void error(Log vfslog, Log commonslog, String JavaDoc message)
143     {
144         if (vfslog != null)
145         {
146             vfslog.error(message);
147         }
148         else if (commonslog != null)
149         {
150             commonslog.error(message);
151         }
152     }
153
154     /**
155      * fatal
156      */

157     public static void fatal(Log vfslog, Log commonslog, String JavaDoc message, Throwable JavaDoc t)
158     {
159         if (vfslog != null)
160         {
161             vfslog.fatal(message, t);
162         }
163         else if (commonslog != null)
164         {
165             commonslog.fatal(message, t);
166         }
167     }
168
169     /**
170      * fatal
171      */

172     public static void fatal(Log vfslog, Log commonslog, String JavaDoc message)
173     {
174         if (vfslog != null)
175         {
176             vfslog.fatal(message);
177         }
178         else if (commonslog != null)
179         {
180             commonslog.fatal(message);
181         }
182     }
183 }
184
Popular Tags