hudson.plugins.analysis.util
Class PluginLogger

java.lang.Object
  extended by hudson.plugins.analysis.util.PluginLogger
Direct Known Subclasses:
NullLogger, StringPluginLogger

public class PluginLogger
extends Object

A simple logger that prefixes each message with the plug-in name.

Author:
Ulli Hafner

Constructor Summary
  PluginLogger(PrintStream logger, String pluginName)
          Creates a new instance of PluginLogger.
protected PluginLogger(String pluginName)
          Creates a new instance of PluginLogger.
 
Method Summary
 void log(String message)
          Logs the specified message.
 void log(Throwable throwable)
          Logs the specified throwable.
 void logLines(String lines)
          Logs several lines that already contain a prefix.
 void printStackTrace(Throwable throwable)
          Logs the stack trace of the throwable.
protected  void setLogger(PrintStream logger)
          Sets the logger to the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginLogger

public PluginLogger(PrintStream logger,
                    String pluginName)
Creates a new instance of PluginLogger.

Parameters:
logger - the actual print stream to log to
pluginName - the plug-in name

PluginLogger

protected PluginLogger(String pluginName)
Creates a new instance of PluginLogger. Note that the logger needs to be set afterwards to avoid throwing a NullPointerException.

Parameters:
pluginName - the plug-in name
Method Detail

setLogger

protected void setLogger(PrintStream logger)
Sets the logger to the specified value.

Parameters:
logger - the value to set

log

public void log(String message)
Logs the specified message.

Parameters:
message - the message

log

public void log(Throwable throwable)
Logs the specified throwable.

Parameters:
throwable - the throwable

printStackTrace

public void printStackTrace(Throwable throwable)
Logs the stack trace of the throwable.

Parameters:
throwable - the throwable

logLines

public void logLines(String lines)
Logs several lines that already contain a prefix.

Parameters:
lines - the lines to log


Copyright © 2004-2012 Hudson. All Rights Reserved.