001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.commons.vfs;
018:
019: import org.apache.commons.logging.Log;
020:
021: /**
022: * This class is to keep the old logging behaviour (for ant-task) and to be able to
023: * correctly use commons-logging.<br>
024: * I hope i could remove it sometimes.
025: *
026: * @author <a href="mailto:imario@apache.org">Mario Ivankovits</a>
027: * @version $Revision: 480428 $ $Date: 2006-11-28 22:15:24 -0800 (Tue, 28 Nov 2006) $
028: */
029: public class VfsLog {
030: // static utility class
031: private VfsLog() {
032: }
033:
034: /**
035: * warning
036: */
037: public static void warn(Log vfslog, Log commonslog, String message,
038: Throwable t) {
039: if (vfslog != null) {
040: vfslog.warn(message, t);
041: } else if (commonslog != null) {
042: commonslog.warn(message, t);
043: }
044: }
045:
046: /**
047: * warning
048: */
049: public static void warn(Log vfslog, Log commonslog, String message) {
050: if (vfslog != null) {
051: vfslog.warn(message);
052: } else if (commonslog != null) {
053: commonslog.warn(message);
054: }
055: }
056:
057: /**
058: * debug
059: */
060: public static void debug(Log vfslog, Log commonslog, String message) {
061: if (vfslog != null) {
062: vfslog.debug(message);
063: } else if (commonslog != null) {
064: commonslog.debug(message);
065: }
066: }
067:
068: /**
069: * debug
070: */
071: public static void debug(Log vfslog, Log commonslog,
072: String message, Throwable t) {
073: if (vfslog != null) {
074: vfslog.debug(message, t);
075: } else if (commonslog != null) {
076: commonslog.debug(message, t);
077: }
078: }
079:
080: /**
081: * info
082: */
083: public static void info(Log vfslog, Log commonslog, String message,
084: Throwable t) {
085: if (vfslog != null) {
086: vfslog.info(message, t);
087: } else if (commonslog != null) {
088: commonslog.info(message, t);
089: }
090: }
091:
092: /**
093: * info
094: */
095: public static void info(Log vfslog, Log commonslog, String message) {
096: if (vfslog != null) {
097: vfslog.info(message);
098: } else if (commonslog != null) {
099: commonslog.info(message);
100: }
101: }
102:
103: /**
104: * error
105: */
106: public static void error(Log vfslog, Log commonslog,
107: String message, Throwable t) {
108: if (vfslog != null) {
109: vfslog.error(message, t);
110: } else if (commonslog != null) {
111: commonslog.error(message, t);
112: }
113: }
114:
115: /**
116: * error
117: */
118: public static void error(Log vfslog, Log commonslog, String message) {
119: if (vfslog != null) {
120: vfslog.error(message);
121: } else if (commonslog != null) {
122: commonslog.error(message);
123: }
124: }
125:
126: /**
127: * fatal
128: */
129: public static void fatal(Log vfslog, Log commonslog,
130: String message, Throwable t) {
131: if (vfslog != null) {
132: vfslog.fatal(message, t);
133: } else if (commonslog != null) {
134: commonslog.fatal(message, t);
135: }
136: }
137:
138: /**
139: * fatal
140: */
141: public static void fatal(Log vfslog, Log commonslog, String message) {
142: if (vfslog != null) {
143: vfslog.fatal(message);
144: } else if (commonslog != null) {
145: commonslog.fatal(message);
146: }
147: }
148: }
|