KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > logging > ChannelIDLogger


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

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 JavaDoc message) {
19     logger.debug(msg(message));
20   }
21
22   public void debug(Object JavaDoc message, Throwable JavaDoc t) {
23     logger.debug(msg(message), t);
24   }
25
26   public void error(Object JavaDoc message) {
27     logger.error(msg(message));
28   }
29
30   public void error(Object JavaDoc message, Throwable JavaDoc t) {
31     logger.error(msg(message), t);
32   }
33
34   public void fatal(Object JavaDoc message) {
35     logger.fatal(msg(message));
36   }
37
38   public void fatal(Object JavaDoc message, Throwable JavaDoc t) {
39     logger.fatal(msg(message), t);
40   }
41
42   public void info(Object JavaDoc message) {
43     logger.info(msg(message));
44   }
45
46   public void info(Object JavaDoc message, Throwable JavaDoc t) {
47     logger.info(msg(message), t);
48   }
49
50   public void warn(Object JavaDoc message) {
51     logger.warn(msg(message));
52   }
53
54   public void warn(Object JavaDoc message, Throwable JavaDoc t) {
55     logger.warn(msg(message), t);
56   }
57
58   public void log(LogLevel level, Object JavaDoc message) {
59     logger.log(level, msg(message));
60   }
61
62   public void log(LogLevel level, Object JavaDoc message, Throwable JavaDoc 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 JavaDoc msg(Object JavaDoc msg) {
83     return cidp.getChannelID() + ": " + msg;
84   }
85
86   public String JavaDoc getName() {
87     return logger.getName();
88   }
89
90 }
91
Popular Tags