001: /*
002: * Enhydra Java Application Server Project
003: *
004: * The contents of this file are subject to the Enhydra Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License on
007: * the Enhydra web site ( http://www.enhydra.org/ ).
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011: * the License for the specific terms governing rights and limitations
012: * under the License.
013: *
014: * The Initial Developer of the Enhydra Application Server is Lutris
015: * Technologies, Inc. The Enhydra Application Server and portions created
016: * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017: * All Rights Reserved.
018: *
019: * Contributor(s):
020: *
021: * $Id: EnhydraXMLCLogger.java,v 1.2 2006-06-15 13:47:00 sinisa Exp $
022: */
023:
024: package com.lutris.logging;
025:
026: import org.enhydra.xml.xmlc.XMLCLogger;
027:
028: /**
029: * XMLC logger interface to PrintWriter streams.
030: */
031: public class EnhydraXMLCLogger implements XMLCLogger {
032:
033: //underlying implementation
034: private final com.lutris.logging.LogChannel m_logChannel;
035:
036: /**
037: * Constructor specifing a single stream to be used for both info
038: * and error logging.
039: */
040: public EnhydraXMLCLogger(LogChannel logChannel) {
041:
042: m_logChannel = logChannel;
043: }
044:
045: /**
046: * Determine if info logging is enabled.
047: */
048: public boolean infoEnabled() {
049: return m_logChannel.isEnabled(Logger.INFO);
050: }
051:
052: /**
053: * Login an info message.
054: */
055: public void logInfo(String msg) {
056: m_logChannel.write(Logger.INFO, msg);
057: }
058:
059: /**
060: * Login an info message with exception.
061: */
062: public void logInfo(String msg, Throwable except) {
063: m_logChannel.write(Logger.INFO, msg, except);
064: }
065:
066: /**
067: * Determine if error logging is enabled.
068: */
069: public boolean errorEnabled() {
070: return m_logChannel.isEnabled(Logger.ERROR);
071: }
072:
073: /**
074: * Login an error message.
075: */
076: public void logError(String msg) {
077: m_logChannel.write(Logger.ERROR, msg);
078: }
079:
080: /**
081: * Login an error message with exception.
082: */
083: public void logError(String msg, Throwable except) {
084: m_logChannel.write(Logger.ERROR, msg, except);
085: }
086:
087: /**
088: * Determine if debug logging is enabled.
089: */
090: public boolean debugEnabled() {
091: return m_logChannel.isEnabled(Logger.DEBUG);
092: }
093:
094: /**
095: * Login an debug message.
096: */
097: public void logDebug(String msg) {
098: m_logChannel.write(Logger.DEBUG, msg);
099: }
100:
101: /**
102: * Login an debug message with exception.
103: */
104: public void logDebug(String msg, Throwable except) {
105: m_logChannel.write(Logger.DEBUG, msg, except);
106: }
107:
108: }
|