001: /*
002: * Copyright 2006 Pentaho Corporation. All rights reserved.
003: * This software was developed by Pentaho Corporation and is provided under the terms
004: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005: * this file except in compliance with the license. If you need a copy of the license,
006: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
007: * BI Platform. The Initial Developer is Pentaho Corporation.
008: *
009: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
011: * the license for the specific language governing your rights and limitations.
012: *
013: * @created May 4, 2005
014: * @author James Dixon
015: *
016: */
017: package org.pentaho.util.logging;
018:
019: import org.pentaho.messages.Messages;
020:
021: public class SimpleLogger implements ILogger {
022:
023: private Object id;
024:
025: public SimpleLogger(Object caller) {
026: id = (caller == null) ? Messages
027: .getString("Logger.DEBUG_LOG_UNKNOWN") : caller.getClass().getName(); //$NON-NLS-1$
028: }
029:
030: public SimpleLogger(String callerName) {
031: id = callerName;
032: }
033:
034: public String getLogLevelName(int localLogLevel) {
035: return Logger.getLogLevelName(localLogLevel);
036: }
037:
038: public int getLogLevel(String localLogLevel) {
039: return Logger.getLogLevel(localLogLevel);
040: }
041:
042: public int getLoggingLevel() {
043: return Logger.getLogLevel();
044: }
045:
046: public int getLogLevel() {
047: return Logger.getLogLevel();
048: }
049:
050: public void setLoggingLevel(int newLogLevel) {
051: Logger.setLogLevel(newLogLevel);
052: }
053:
054: public void trace(String message) {
055: Logger.trace(id, message);
056: }
057:
058: public void debug(String message) {
059: Logger.debug(id, message);
060: }
061:
062: public void info(String message) {
063: Logger.info(id, message);
064: }
065:
066: public void warn(String message) {
067: Logger.warn(id, message);
068: }
069:
070: public void error(String message) {
071: Logger.error(id, message);
072: }
073:
074: public void fatal(String message) {
075: Logger.fatal(id, message);
076: }
077:
078: public void trace(String message, Throwable error) {
079: Logger.trace(id, message, error);
080: }
081:
082: public void debug(String message, Throwable error) {
083: Logger.debug(id, message, error);
084: }
085:
086: public void info(String message, Throwable error) {
087: Logger.info(id, message, error);
088: }
089:
090: public void warn(String message, Throwable error) {
091: Logger.warn(id, message, error);
092: }
093:
094: public void error(String message, Throwable error) {
095: Logger.error(id, message, error);
096: }
097:
098: public void fatal(String message, Throwable error) {
099: Logger.fatal(id, message, error);
100: }
101:
102: }
|