1 33 34 package org.slf4j.impl; 35 36 import org.apache.commons.logging.Log; 37 import org.slf4j.Logger; 38 import org.slf4j.helpers.MarkerIgnoringBase; 39 import org.slf4j.helpers.MessageFormatter; 40 41 48 public final class JCLLoggerAdapter extends MarkerIgnoringBase { 49 final Log log; 50 final String name; 51 52 JCLLoggerAdapter(Log log, String name) { 55 this.log = log; 56 this.name = name; 57 } 58 59 public String getName() { 60 return name; 61 } 62 63 67 public boolean isTraceEnabled() { 68 return log.isTraceEnabled(); 69 } 70 71 73 79 public void trace(String msg) { 80 log.trace(msg); 81 } 82 83 97 public void trace(String format, Object arg) { 98 if (log.isDebugEnabled()) { 99 String msgStr = MessageFormatter.format(format, arg); 100 log.trace(msgStr); 101 } 102 } 103 104 120 public void trace(String format, Object arg1, Object arg2) { 121 if (log.isDebugEnabled()) { 122 String msgStr = MessageFormatter.format(format, arg1, arg2); 123 log.trace(msgStr); 124 } 125 } 126 127 128 140 public void trace(String format, Object [] argArray) { 141 if (log.isDebugEnabled()) { 142 String msgStr = MessageFormatter.arrayFormat(format, argArray); 143 log.trace(msgStr); 144 } 145 } 146 147 156 public void trace(String msg, Throwable t) { 157 log.trace(msg, t); 158 } 159 160 161 165 public boolean isDebugEnabled() { 166 return log.isDebugEnabled(); 167 } 168 169 171 177 public void debug(String msg) { 178 log.debug(msg); 179 } 180 181 195 public void debug(String format, Object arg) { 196 if (log.isDebugEnabled()) { 197 String msgStr = MessageFormatter.format(format, arg); 198 log.debug(msgStr); 199 } 200 } 201 202 218 public void debug(String format, Object arg1, Object arg2) { 219 if (log.isDebugEnabled()) { 220 String msgStr = MessageFormatter.format(format, arg1, arg2); 221 log.debug(msgStr); 222 } 223 } 224 225 226 238 public void debug(String format, Object [] argArray) { 239 if (log.isDebugEnabled()) { 240 String msgStr = MessageFormatter.arrayFormat(format, argArray); 241 log.debug(msgStr); 242 } 243 } 244 245 254 public void debug(String msg, Throwable t) { 255 log.debug(msg, t); 256 } 257 258 262 public boolean isInfoEnabled() { 263 return log.isInfoEnabled(); 264 } 265 266 272 public void info(String msg) { 273 log.info(msg); 274 } 275 276 290 291 public void info(String format, Object arg) { 292 if (log.isInfoEnabled()) { 293 String msgStr = MessageFormatter.format(format, arg); 294 log.info(msgStr); 295 } 296 } 297 313 public void info(String format, Object arg1, Object arg2) { 314 if (log.isInfoEnabled()) { 315 String msgStr = MessageFormatter.format(format, arg1, arg2); 316 log.info(msgStr); 317 } 318 } 319 320 332 public void info(String format, Object [] argArray) { 333 if (log.isInfoEnabled()) { 334 String msgStr = MessageFormatter.arrayFormat(format, argArray); 335 log.info(msgStr); 336 } 337 } 338 339 340 349 public void info(String msg, Throwable t) { 350 log.info(msg, t); 351 } 352 353 357 public boolean isWarnEnabled() { 358 return log.isWarnEnabled(); 359 } 360 361 367 public void warn(String msg) { 368 log.warn(msg); 369 } 370 371 385 public void warn(String format, Object arg) { 386 if (log.isWarnEnabled()) { 387 String msgStr = MessageFormatter.format(format, arg); 388 log.warn(msgStr); 389 } 390 } 391 392 408 public void warn(String format, Object arg1, Object arg2) { 409 if (log.isWarnEnabled()) { 410 String msgStr = MessageFormatter.format(format, arg1, arg2); 411 log.warn(msgStr); 412 } 413 } 414 415 427 public void warn(String format, Object [] argArray) { 428 if (log.isWarnEnabled()) { 429 String msgStr = MessageFormatter.arrayFormat(format, argArray); 430 log.warn(msgStr); 431 } 432 } 433 434 435 444 445 public void warn(String msg, Throwable t) { 446 log.warn(msg, t); 447 } 448 449 450 454 public boolean isErrorEnabled() { 455 return log.isErrorEnabled(); 456 } 457 458 464 public void error(String msg) { 465 log.error(msg); 466 } 467 468 482 public void error(String format, Object arg) { 483 if (log.isErrorEnabled()) { 484 String msgStr = MessageFormatter.format(format, arg); 485 log.error(msgStr); 486 } 487 } 488 489 505 public void error(String format, Object arg1, Object arg2) { 506 if (log.isErrorEnabled()) { 507 String msgStr = MessageFormatter.format(format, arg1, arg2); 508 log.error(msgStr); 509 } 510 } 511 512 524 public void error(String format, Object [] argArray) { 525 if (log.isErrorEnabled()) { 526 String msgStr = MessageFormatter.arrayFormat(format, argArray); 527 log.error(msgStr); 528 } 529 } 530 531 532 541 542 public void error(String msg, Throwable t) { 543 log.error(msg, t); 544 } 545 546 } 547 | Popular Tags |