001: /**
002: * Copyright (C) 2001-2005 France Telecom R&D
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */package org.objectweb.util.monolog.wrapper.remote.api;
018:
019: import org.objectweb.util.monolog.api.BasicLevel;
020: import org.objectweb.util.monolog.api.Handler;
021: import org.objectweb.util.monolog.api.TopicalLogger;
022:
023: import java.io.Serializable;
024:
025: /**
026: * Defines an holder of information about a logger.
027: *
028: * @author S.Chassande-Barrioz
029: */
030: public class LoggerInfo implements Serializable {
031:
032: /**
033: * contains the topic list of the logger.
034: */
035: public String[] topics;
036:
037: /**
038: * is the int value of the current logger level
039: */
040: public int level;
041:
042: /**
043: * is the name of the current logger level
044: */
045: public String levelName;
046:
047: /**
048: * Is the list of the handler assigned to the logger
049: */
050: public String[] handlerNames;
051:
052: /**
053: * Indicates if the logger inherits handlers from its parent.
054: */
055: public boolean additivity;
056:
057: /**
058: * Build a Loggerinfo from a TopicalLogger.
059: * @param l is the TopicalLogger
060: */
061: public LoggerInfo(TopicalLogger l) {
062: topics = l.getTopic();
063: level = l.getCurrentIntLevel();
064: levelName = l.getCurrentLevel().getName();
065: Handler[] hs = l.getHandler();
066: handlerNames = new String[hs.length];
067: for (int i = 0; i < hs.length; i++) {
068: handlerNames[i] = hs[i].getName();
069: }
070: additivity = l.getAdditivity();
071: }
072:
073: public boolean isAdditivity() {
074: return additivity;
075: }
076:
077: public void setAdditivity(boolean additivity) {
078: this .additivity = additivity;
079: }
080:
081: public String[] getHandlerNames() {
082: return handlerNames;
083: }
084:
085: public void setHandlerNames(String[] handlerNames) {
086: this .handlerNames = handlerNames;
087: }
088:
089: public int getLevel() {
090: return level;
091: }
092:
093: public void setLevel(int level) {
094: this .level = level;
095: }
096:
097: public String getLevelName() {
098: return levelName;
099: }
100:
101: public void setLevelName(String levelName) {
102: this .levelName = levelName;
103: }
104:
105: public String[] getTopics() {
106: return topics;
107: }
108:
109: public void setTopics(String[] topics) {
110: this .topics = topics;
111: }
112:
113: public String toString() {
114: StringBuffer sb = new StringBuffer();
115: sb.append("topic=[");
116: for (int i = 0; i < topics.length; i++) {
117: if (i != 0) {
118: sb.append(", ");
119: }
120: sb.append(topics[i]);
121: }
122: sb.append("]");
123:
124: sb.append(", level=[");
125: sb.append(levelName);
126: sb.append("]");
127:
128: if (handlerNames.length > 0) {
129: sb.append(", handler=[");
130: for (int i = 0; i < handlerNames.length; i++) {
131: if (i != 0) {
132: sb.append(", ");
133: }
134: sb.append(handlerNames[i]);
135: }
136: sb.append("]");
137: }
138: if (!additivity) {
139: sb.append(", no handler inherited");
140: }
141: return sb.toString();
142: }
143: }
|