001 /*
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements. See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership. The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License. You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied. See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 *
020 */
021 package org.apache.qpid.transport.util;
022
023 import org.slf4j.LoggerFactory;
024
025 /**
026 * Logger
027 *
028 */
029
030 public final class Logger
031 {
032
033 public static final Logger get(Class<?> klass)
034 {
035 return new Logger(LoggerFactory.getLogger(klass));
036 }
037
038 private final org.slf4j.Logger log;
039
040 private Logger(org.slf4j.Logger log)
041 {
042 this.log = log;
043 }
044
045 public boolean isDebugEnabled()
046 {
047 return log.isDebugEnabled();
048 }
049
050 public void debug(String message, Object ... args)
051 {
052 if (log.isDebugEnabled())
053 {
054 log.debug(String.format(message, args));
055 }
056 }
057
058 public void debug(Throwable t, String message, Object ... args)
059 {
060 if (log.isDebugEnabled())
061 {
062 log.debug(String.format(message, args), t);
063 }
064 }
065
066 public void error(String message, Object ... args)
067 {
068 if (log.isErrorEnabled())
069 {
070 log.error(String.format(message, args));
071 }
072 }
073
074 public void error(Throwable t, String message, Object ... args)
075 {
076 if (log.isErrorEnabled())
077 {
078 log.error(String.format(message, args), t);
079 }
080 }
081
082 public void warn(String message, Object ... args)
083 {
084 if (log.isWarnEnabled())
085 {
086 log.warn(String.format(message, args));
087 }
088 }
089
090 public void warn(Throwable t, String message, Object ... args)
091 {
092 if (log.isWarnEnabled())
093 {
094 log.warn(String.format(message, args), t);
095 }
096 }
097
098 public void info(String message, Object ... args)
099 {
100 if (log.isInfoEnabled())
101 {
102 log.info(String.format(message, args));
103 }
104 }
105
106 public void info(Throwable t, String message, Object ... args)
107 {
108 if (log.isInfoEnabled())
109 {
110 log.info(String.format(message, args), t);
111 }
112 }
113
114 public void trace(String message, Object ... args)
115 {
116 if (log.isTraceEnabled())
117 {
118 log.trace(String.format(message, args));
119 }
120 }
121
122 public void trace(Throwable t, String message, Object ... args)
123 {
124 if (log.isTraceEnabled())
125 {
126 log.trace(String.format(message, args), t);
127 }
128 }
129
130 }
|