001: /**
002: * Copyright (C) 2001-2003 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.api;
018:
019: /**
020: * A Logger implementation receives event messages from an object and exports
021: * them. Each Logger is associated with a log level and discards log requests
022: * that are below this level. Furthermore the Logger interface extends the Handler
023: * interface and represents therefore a type of output.
024: *
025: * @author S.Chassande-Barrioz
026: */
027: public interface Logger extends Handler {
028:
029: /**
030: * Permits to set the level with an integer value
031: */
032: void setIntLevel(int level);
033:
034: /**
035: * Permits to set the level with a Level instance.
036: */
037: void setLevel(Level l);
038:
039: /**
040: * Returns the current level value under the integer format
041: */
042: int getCurrentIntLevel();
043:
044: /**
045: * Returns the current level value under the Level format
046: */
047: Level getCurrentLevel();
048:
049: /**
050: * Check if a message of the given level would actually be logged by this logger.
051: */
052: boolean isLoggable(int level);
053:
054: /**
055: * Check if a message of the given level would actually be logged by this logger.
056: */
057: boolean isLoggable(Level l);
058:
059: /**
060: * Check if this logger is enabled.
061: */
062: boolean isOn();
063:
064: /**
065: * Log a message, with no arguments.
066: * If the logger is currently enabled for the given message level then the
067: * given message is treated
068: */
069: void log(int level, Object message);
070:
071: /**
072: * Log a message, with no arguments.
073: * If the logger is currently enabled for the given message level then the
074: * given message is treated
075: */
076: void log(Level level, Object message);
077:
078: /**
079: * Log a message, with a throwable arguments which can represent an
080: * error or a context..
081: */
082: void log(int level, Object message, Throwable throwable);
083:
084: /**
085: * Log a message, with a throwable arguments which can represent an
086: * error or a context..
087: */
088: void log(Level level, Object message, Throwable throwable);
089:
090: /**
091: * Log a message, with a location and method arguments. The location
092: * parameter can be the object instance which logs the event, or a string
093: * representation of the object.
094: * The method argument can be a java.lang.reflect.Method or a string which
095: * represents the method name.
096: */
097: void log(int level, Object message, Object location, Object method);
098:
099: /**
100: * Log a message, with a location and method arguments. The location
101: * parameter can be the object instance which logs the event, or a string
102: * representation of the object.
103: * The method argument can be a java.lang.reflect.Method or a string which
104: * represents the method name.
105: */
106: void log(Level l, Object message, Object location, Object method);
107:
108: /**
109: * Log a message, with a location, method and throwable arguments.
110: * The location parameter can be the object instance which logs the
111: * event, or a string representation of the object..
112: * The method argument can be a java.lang.reflect.Method or a string which
113: * represents the method name.
114: * The throwable parameter permits to log an Exception.
115: */
116: void log(int level, Object message, Throwable throwable,
117: Object location, Object method);
118:
119: /**
120: * Log a message, with a location, method and throwable arguments.
121: * The location parameter can be the object instance which logs the
122: * event, or a string representation of the object..
123: * The method argument can be a java.lang.reflect.Method or a string which
124: * represents the method name.
125: * The throwable parameter permits to log an Exception.
126: */
127: void log(Level level, Object message, Throwable throwable,
128: Object location, Object method);
129:
130: /**
131: * Enables this logger
132: */
133: void turnOn();
134:
135: /**
136: * Disables this logger
137: */
138: void turnOff();
139:
140: }
|