01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.logging;
05:
06: public class ConnectionIdLogger implements TCLogger {
07:
08: private final ConnectionIDProvider cidp;
09: private final TCLogger logger;
10:
11: public ConnectionIdLogger(
12: ConnectionIDProvider connectionIDProvider, TCLogger logger) {
13: this .cidp = connectionIDProvider;
14: this .logger = logger;
15: }
16:
17: public void debug(Object message) {
18: logger.debug(msg(message));
19: }
20:
21: public void debug(Object message, Throwable t) {
22: logger.debug(msg(message), t);
23: }
24:
25: public void error(Object message) {
26: logger.error(msg(message));
27: }
28:
29: public void error(Object message, Throwable t) {
30: logger.error(msg(message), t);
31: }
32:
33: public void fatal(Object message) {
34: logger.fatal(msg(message));
35: }
36:
37: public void fatal(Object message, Throwable t) {
38: logger.fatal(msg(message), t);
39: }
40:
41: public void info(Object message) {
42: logger.info(msg(message));
43: }
44:
45: public void info(Object message, Throwable t) {
46: logger.info(msg(message), t);
47: }
48:
49: public void warn(Object message) {
50: logger.warn(msg(message));
51: }
52:
53: public void warn(Object message, Throwable t) {
54: logger.warn(msg(message), t);
55: }
56:
57: public void log(LogLevel level, Object message) {
58: logger.log(level, msg(message));
59: }
60:
61: public void log(LogLevel level, Object message, Throwable t) {
62: logger.log(level, msg(message), t);
63: }
64:
65: public boolean isDebugEnabled() {
66: return logger.isDebugEnabled();
67: }
68:
69: public boolean isInfoEnabled() {
70: return logger.isInfoEnabled();
71: }
72:
73: public void setLevel(LogLevel level) {
74: logger.setLevel(level);
75: }
76:
77: public LogLevel getLevel() {
78: return logger.getLevel();
79: }
80:
81: private Object msg(Object msg) {
82: return cidp.getConnectionId() + ": " + msg;
83: }
84:
85: public String getName() {
86: return logger.getName();
87: }
88:
89: }
|