1 4 package com.tc.logging; 5 6 import com.tc.net.protocol.tcm.ChannelIDProvider; 7 8 public class ChannelIDLogger implements TCLogger { 9 10 private final ChannelIDProvider cidp; 11 private final TCLogger logger; 12 13 public ChannelIDLogger(ChannelIDProvider channelIDProvider, TCLogger logger) { 14 this.cidp = channelIDProvider; 15 this.logger = logger; 16 } 17 18 public void debug(Object message) { 19 logger.debug(msg(message)); 20 } 21 22 public void debug(Object message, Throwable t) { 23 logger.debug(msg(message), t); 24 } 25 26 public void error(Object message) { 27 logger.error(msg(message)); 28 } 29 30 public void error(Object message, Throwable t) { 31 logger.error(msg(message), t); 32 } 33 34 public void fatal(Object message) { 35 logger.fatal(msg(message)); 36 } 37 38 public void fatal(Object message, Throwable t) { 39 logger.fatal(msg(message), t); 40 } 41 42 public void info(Object message) { 43 logger.info(msg(message)); 44 } 45 46 public void info(Object message, Throwable t) { 47 logger.info(msg(message), t); 48 } 49 50 public void warn(Object message) { 51 logger.warn(msg(message)); 52 } 53 54 public void warn(Object message, Throwable t) { 55 logger.warn(msg(message), t); 56 } 57 58 public void log(LogLevel level, Object message) { 59 logger.log(level, msg(message)); 60 } 61 62 public void log(LogLevel level, Object message, Throwable t) { 63 logger.log(level, msg(message), t); 64 } 65 66 public boolean isDebugEnabled() { 67 return logger.isDebugEnabled(); 68 } 69 70 public boolean isInfoEnabled() { 71 return logger.isInfoEnabled(); 72 } 73 74 public void setLevel(LogLevel level) { 75 logger.setLevel(level); 76 } 77 78 public LogLevel getLevel() { 79 return logger.getLevel(); 80 } 81 82 private Object msg(Object msg) { 83 return cidp.getChannelID() + ": " + msg; 84 } 85 86 public String getName() { 87 return logger.getName(); 88 } 89 90 } 91 | Popular Tags |