maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r628055 - in /maven/doxia/doxia/trunk/doxia-logging-api: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/maven/ src/main/java/org/apache/maven/doxia/ src/main/java/org/apache/maven/doxi...
Date Fri, 15 Feb 2008 13:14:33 GMT
Author: vsiveton
Date: Fri Feb 15 05:14:31 2008
New Revision: 628055

URL: http://svn.apache.org/viewvc?rev=628055&view=rev
Log:
DOXIA-145: Adding logger feature

o first import of new logging module
o based on lukas's work
o collaborative work after good discussions on IRC

Added:
    maven/doxia/doxia/trunk/doxia-logging-api/
    maven/doxia/doxia/trunk/doxia-logging-api/pom.xml   (with props)
    maven/doxia/doxia/trunk/doxia-logging-api/src/
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/Log.java
  (with props)
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/LogEnabled.java
  (with props)
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/PlexusLoggerWrapper.java
  (with props)
    maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/SystemStreamLog.java
  (with props)

Added: maven/doxia/doxia/trunk/doxia-logging-api/pom.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-logging-api/pom.xml?rev=628055&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-logging-api/pom.xml (added)
+++ maven/doxia/doxia/trunk/doxia-logging-api/pom.xml Fri Feb 15 05:14:31 2008
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <artifactId>doxia</artifactId>
+    <groupId>org.apache.maven.doxia</groupId>
+    <version>1.0-beta-1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>doxia-logging-api</artifactId>
+  <name>Doxia :: Sink API</name>
+  <description>Doxia Logging API.</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-container-default</artifactId>
+    </dependency>
+  </dependencies>
+</project>

Propchange: maven/doxia/doxia/trunk/doxia-logging-api/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia/trunk/doxia-logging-api/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/Log.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/Log.java?rev=628055&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/Log.java
(added)
+++ maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/Log.java
Fri Feb 15 05:14:31 2008
@@ -0,0 +1,188 @@
+package org.apache.maven.doxia.logging;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * This interface supplies the API for providing feedback to the user from
+ * a Parser or Sink, using standard <code>Doxia</code> channels.
+ * <br/>
+ * There should be no big surprises here, although you may notice that the methods accept
+ * <code>java.lang.CharSequence</code> rather than <code>java.lang.String</code>.
This is provided mainly as a
+ * convenience, to enable developers to pass things like <code>java.lang.StringBuffer</code>
directly into the logger,
+ * rather than formatting first by calling <code>toString()</code>.
+ * <br/>
+ * Based on <code>org.apache.maven.plugin.logging.Log</code>.
+ *
+ * @author jdcasey
+ * @author ltheussl
+ * @version $Id$
+ * @since 1.0-beta-1
+ */
+public interface Log
+{
+    /** Typecode for debugging messages. */
+    int LEVEL_DEBUG = 0;
+
+    /** Typecode for informational messages. */
+    int LEVEL_INFO = 1;
+
+    /** Typecode for warning messages. */
+    int LEVEL_WARN = 2;
+
+    /** Typecode for error messages. */
+    int LEVEL_ERROR = 3;
+
+    /** Typecode for fatal error messages. */
+    int LEVEL_FATAL = 4;
+
+    /** Typecode for disabled log levels. */
+    int LEVEL_DISABLED = 5;
+
+    /**
+     * Set the current log level.
+     *
+     * @param level the log level to set.
+     */
+    void setLogLevel( int level );
+
+    /**
+     * @return true if the <b>debug</b> error level is enabled
+     */
+    boolean isDebugEnabled();
+
+    /**
+     * Send a message to the user in the <b>debug</b> error level.
+     *
+     * @param content
+     */
+    void debug( CharSequence content );
+
+    /**
+     * Send a message (and accompanying exception) to the user in the <b>debug</b>
error level.
+     * <br/>
+     * The error's stacktrace will be output when this error level is enabled.
+     *
+     * @param content
+     * @param error
+     */
+    void debug( CharSequence content, Throwable error );
+
+    /**
+     * Send an exception to the user in the <b>debug</b> error level.
+     * <br/>
+     * The stack trace for this exception will be output when this error level is enabled.
+     *
+     * @param error
+     */
+    void debug( Throwable error );
+
+    /**
+     * @return true if the <b>info</b> error level is enabled
+     */
+    boolean isInfoEnabled();
+
+    /**
+     * Send a message to the user in the <b>info</b> error level.
+     *
+     * @param content
+     */
+    void info( CharSequence content );
+
+    /**
+     * Send a message (and accompanying exception) to the user in the <b>info</b>
error level.
+     * <br/>
+     * The error's stacktrace will be output when this error level is enabled.
+     *
+     * @param content
+     * @param error
+     */
+    void info( CharSequence content, Throwable error );
+
+    /**
+     * Send an exception to the user in the <b>info</b> error level.
+     * <br/>
+     * The stack trace for this exception will be output when this error level is enabled.
+     *
+     * @param error
+     */
+    void info( Throwable error );
+
+    /**
+     * @return true if the <b>warn</b> error level is enabled
+     */
+    boolean isWarnEnabled();
+
+    /**
+     * Send a message to the user in the <b>warn</b> error level.
+     *
+     * @param content
+     */
+    void warn( CharSequence content );
+
+    /**
+     * Send a message (and accompanying exception) to the user in the <b>warn</b>
error level.
+     * <br/>
+     * The error's stacktrace will be output when this error level is enabled.
+     *
+     * @param content
+     * @param error
+     */
+    void warn( CharSequence content, Throwable error );
+
+    /**
+     * Send an exception to the user in the <b>warn</b> error level.
+     * <br/>
+     * The stack trace for this exception will be output when this error level is enabled.
+     *
+     * @param error
+     */
+    void warn( Throwable error );
+
+    /**
+     * @return true if the <b>error</b> error level is enabled
+     */
+    boolean isErrorEnabled();
+
+    /**
+     * Send a message to the user in the <b>error</b> error level.
+     *
+     * @param content
+     */
+    void error( CharSequence content );
+
+    /**
+     * Send a message (and accompanying exception) to the user in the <b>error</b>
error level.
+     * <br/>
+     * The error's stacktrace will be output when this error level is enabled.
+     *
+     * @param content
+     * @param error
+     */
+    void error( CharSequence content, Throwable error );
+
+    /**
+     * Send an exception to the user in the <b>error</b> error level.
+     * <br/>
+     * The stack trace for this exception will be output when this error level is enabled.
+     *
+     * @param error
+     */
+    void error( Throwable error );
+}

Propchange: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/Log.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/Log.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/LogEnabled.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/LogEnabled.java?rev=628055&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/LogEnabled.java
(added)
+++ maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/LogEnabled.java
Fri Feb 15 05:14:31 2008
@@ -0,0 +1,40 @@
+package org.apache.maven.doxia.logging;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ * An interface for <code>Doxia</code> components (mainly Sink, Parser and Macro)
that need the ability to log.
+ * <br/>
+ * Based on <code>org.codehaus.plexus.logging.LogEnabled</code>.
+ *
+ * @author ltheussl
+ * @version $Id$
+ * @since 1.0-beta-1
+ */
+public interface LogEnabled
+{
+    /**
+     * Enable a <code>Doxia</code> logger for this <code>Doxia</code>
component.
+     *
+     * @param log a Log.
+     */
+    void enableLogging( Log log );
+}

Propchange: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/LogEnabled.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/LogEnabled.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/PlexusLoggerWrapper.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/PlexusLoggerWrapper.java?rev=628055&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/PlexusLoggerWrapper.java
(added)
+++ maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/PlexusLoggerWrapper.java
Fri Feb 15 05:14:31 2008
@@ -0,0 +1,181 @@
+package org.apache.maven.doxia.logging;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.logging.Log;
+
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Wrap a Plexus logger into a Doxia logger.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @since 1.0-beta-1
+ * @see org.apache.maven.plugin.logging.Logger
+ */
+public class PlexusLoggerWrapper
+    implements Log
+{
+    private final Logger logger;
+
+    /**
+     * @param logger
+     */
+    public PlexusLoggerWrapper( Logger logger )
+    {
+        this.logger = logger;
+    }
+
+    /** {@inheritDoc} */
+    public void setLogLevel( int level )
+    {
+        if ( level <= LEVEL_DEBUG )
+        {
+            logger.setThreshold( Logger.LEVEL_DEBUG );
+        }
+        else if ( level <= LEVEL_INFO )
+        {
+            logger.setThreshold( Logger.LEVEL_INFO );
+        }
+        else if ( level <= LEVEL_WARN )
+        {
+            logger.setThreshold( Logger.LEVEL_WARN );
+        }
+        else if ( level <= LEVEL_ERROR )
+        {
+            logger.setThreshold( Logger.LEVEL_ERROR );
+        }
+        else
+        {
+            logger.setThreshold( Logger.LEVEL_DISABLED );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void debug( CharSequence content )
+    {
+        logger.debug( toString( content ) );
+    }
+
+    /** {@inheritDoc} */
+    public void debug( CharSequence content, Throwable error )
+    {
+        logger.debug( toString( content ), error );
+    }
+
+    /** {@inheritDoc} */
+    public void debug( Throwable error )
+    {
+        logger.debug( "", error );
+    }
+
+    /** {@inheritDoc} */
+    public void info( CharSequence content )
+    {
+        logger.info( toString( content ) );
+    }
+
+    /** {@inheritDoc} */
+    public void info( CharSequence content, Throwable error )
+    {
+        logger.info( toString( content ), error );
+    }
+
+    /** {@inheritDoc} */
+    public void info( Throwable error )
+    {
+        logger.info( "", error );
+    }
+
+    /** {@inheritDoc} */
+    public void warn( CharSequence content )
+    {
+        logger.warn( toString( content ) );
+    }
+
+    /** {@inheritDoc} */
+    public void warn( CharSequence content, Throwable error )
+    {
+        logger.warn( toString( content ), error );
+    }
+
+    /** {@inheritDoc} */
+    public void warn( Throwable error )
+    {
+        logger.warn( "", error );
+    }
+
+    /** {@inheritDoc} */
+    public void error( CharSequence content )
+    {
+        logger.error( toString( content ) );
+    }
+
+    /** {@inheritDoc} */
+    public void error( CharSequence content, Throwable error )
+    {
+        logger.error( toString( content ), error );
+    }
+
+    /** {@inheritDoc} */
+    public void error( Throwable error )
+    {
+        logger.error( "", error );
+    }
+
+    /** {@inheritDoc} */
+    public boolean isDebugEnabled()
+    {
+        return logger.isDebugEnabled();
+    }
+
+    /** {@inheritDoc} */
+    public boolean isInfoEnabled()
+    {
+        return logger.isInfoEnabled();
+    }
+
+    /** {@inheritDoc} */
+    public boolean isWarnEnabled()
+    {
+        return logger.isWarnEnabled();
+    }
+
+    /** {@inheritDoc} */
+    public boolean isErrorEnabled()
+    {
+        return logger.isErrorEnabled();
+    }
+
+    // ----------------------------------------------------------------------
+    // Private methods
+    // ----------------------------------------------------------------------
+
+    private String toString( CharSequence content )
+    {
+        if ( content == null )
+        {
+            return "";
+        }
+
+        return content.toString();
+    }
+}

Propchange: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/PlexusLoggerWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/PlexusLoggerWrapper.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/SystemStreamLog.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/SystemStreamLog.java?rev=628055&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/SystemStreamLog.java
(added)
+++ maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/SystemStreamLog.java
Fri Feb 15 05:14:31 2008
@@ -0,0 +1,239 @@
+package org.apache.maven.doxia.logging;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * Logger with "standard" output and error output stream. The log prefix is voluntarily in
lower case.
+ * <br/>
+ * Based on <code>org.apache.maven.plugin.logging.SystemStreamLog</code>.
+ *
+ * @author jdcasey
+ * @author ltheussl
+ * @version $Id$
+ * @since 1.0-beta-1
+ */
+public class SystemStreamLog
+    implements Log
+{
+    private static final String EOL = System.getProperty( "line.separator" );
+
+    private int currentLevel = LEVEL_INFO;
+
+    /** {@inheritDoc} */
+    public void setLogLevel( int level )
+    {
+        if ( level <= LEVEL_DEBUG )
+        {
+            currentLevel = LEVEL_DEBUG;
+        }
+        else if ( level <= LEVEL_INFO )
+        {
+            currentLevel = LEVEL_INFO;
+        }
+        else if ( level <= LEVEL_WARN )
+        {
+            currentLevel = LEVEL_WARN;
+        }
+        else if ( level <= LEVEL_ERROR )
+        {
+            currentLevel = LEVEL_ERROR;
+        }
+        else
+        {
+            currentLevel = LEVEL_DISABLED;
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void debug( CharSequence content )
+    {
+        if ( isDebugEnabled() )
+        {
+            print( "debug", content );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void debug( CharSequence content, Throwable error )
+    {
+        if ( isDebugEnabled() )
+        {
+            print( "debug", content, error );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void debug( Throwable error )
+    {
+        if ( isDebugEnabled() )
+        {
+            print( "debug", error );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void info( CharSequence content )
+    {
+        if ( isInfoEnabled() )
+        {
+            print( "info", content );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void info( CharSequence content, Throwable error )
+    {
+        if ( isInfoEnabled() )
+        {
+            print( "info", content, error );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void info( Throwable error )
+    {
+        if ( isInfoEnabled() )
+        {
+            print( "info", error );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void warn( CharSequence content )
+    {
+        if ( isWarnEnabled() )
+        {
+            print( "warn", content );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void warn( CharSequence content, Throwable error )
+    {
+        if ( isWarnEnabled() )
+        {
+            print( "warn", content, error );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void warn( Throwable error )
+    {
+        if ( isWarnEnabled() )
+        {
+            print( "warn", error );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void error( CharSequence content )
+    {
+        if ( isErrorEnabled() )
+        {
+            System.err.println( "[error] " + content.toString() );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void error( CharSequence content, Throwable error )
+    {
+        if ( isErrorEnabled() )
+        {
+            StringWriter sWriter = new StringWriter();
+            PrintWriter pWriter = new PrintWriter( sWriter );
+
+            error.printStackTrace( pWriter );
+
+            System.err.println( "[error] " + content.toString()
+                + EOL + EOL + sWriter.toString() );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void error( Throwable error )
+    {
+        if ( isErrorEnabled() )
+        {
+            StringWriter sWriter = new StringWriter();
+            PrintWriter pWriter = new PrintWriter( sWriter );
+
+            error.printStackTrace( pWriter );
+
+            System.err.println( "[error] " + sWriter.toString() );
+        }
+    }
+
+    /** {@inheritDoc} */
+    public boolean isDebugEnabled()
+    {
+        return ( currentLevel <= LEVEL_DEBUG );
+    }
+
+    /** {@inheritDoc} */
+    public boolean isInfoEnabled()
+    {
+        return ( currentLevel <= LEVEL_INFO );
+    }
+
+    /** {@inheritDoc} */
+    public boolean isWarnEnabled()
+    {
+        return ( currentLevel <= LEVEL_WARN );
+    }
+
+    /** {@inheritDoc} */
+    public boolean isErrorEnabled()
+    {
+        return ( currentLevel <= LEVEL_ERROR );
+    }
+
+      //
+     // private
+    //
+
+    private void print( String prefix, CharSequence content )
+    {
+        System.out.println( "[" + prefix + "] " + content.toString() );
+    }
+
+    private void print( String prefix, Throwable error )
+    {
+        StringWriter sWriter = new StringWriter();
+        PrintWriter pWriter = new PrintWriter( sWriter );
+
+        error.printStackTrace( pWriter );
+
+        System.out.println( "[" + prefix + "] " + sWriter.toString() );
+    }
+
+    private void print( String prefix, CharSequence content, Throwable error )
+    {
+        StringWriter sWriter = new StringWriter();
+        PrintWriter pWriter = new PrintWriter( sWriter );
+
+        error.printStackTrace( pWriter );
+
+        System.out.println( "[" + prefix + "] " + content.toString()
+            + EOL + EOL + sWriter.toString() );
+    }
+}

Propchange: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/SystemStreamLog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia/trunk/doxia-logging-api/src/main/java/org/apache/maven/doxia/logging/SystemStreamLog.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message