1 17 package org.apache.avalon.framework.logger; 18 19 import org.apache.avalon.framework.logger.Logger; 20 import org.apache.commons.logging.Log; 21 import org.apache.commons.logging.LogFactory; 22 23 24 32 public class CommonsLogger implements Logger { 33 34 private final Log log; 35 private final String name; 36 37 46 public CommonsLogger(final Log log, final String name) 47 { 48 this.log = log; 49 this.name = name; 50 } 51 52 55 public void debug(final String message) 56 { 57 this.log.debug(message); 58 } 59 60 63 public void debug(final String message, final Throwable throwable) 64 { 65 this.log.debug(message, throwable); 66 } 67 68 71 public boolean isDebugEnabled() 72 { 73 return this.log.isDebugEnabled(); 74 } 75 76 79 public void info(final String message) 80 { 81 this.log.info(message); 82 } 83 84 87 public void info(final String message, final Throwable throwable) 88 { 89 this.log.info(message, throwable); 90 } 91 92 95 public boolean isInfoEnabled() 96 { 97 return this.log.isInfoEnabled(); 98 } 99 100 103 public void warn(final String message) 104 { 105 this.log.warn(message); 106 } 107 108 111 public void warn(final String message, final Throwable throwable) 112 { 113 this.log.warn(message, throwable); 114 } 115 116 119 public boolean isWarnEnabled() 120 { 121 return this.log.isWarnEnabled(); 122 } 123 124 127 public void error(final String message) 128 { 129 this.log.error(message); 130 } 131 132 135 public void error(final String message, final Throwable throwable) 136 { 137 this.log.error(message, throwable); 138 } 139 140 143 public boolean isErrorEnabled() 144 { 145 return this.log.isErrorEnabled(); 146 } 147 148 151 public void fatalError(final String message) 152 { 153 this.log.fatal(message); 154 } 155 156 159 public void fatalError(final String message, final Throwable throwable) 160 { 161 this.log.fatal(message, throwable); 162 } 163 164 167 public boolean isFatalErrorEnabled() 168 { 169 return this.log.isFatalEnabled(); 170 } 171 172 175 public Logger getChildLogger(final String name) 176 { 177 final String newName = this.name + '.' + name; 178 return new CommonsLogger(LogFactory.getLog(newName), newName); 179 } 180 } 181 | Popular Tags |