com.puppycrawl.tools.checkstyle

Class DefaultLogger

public class DefaultLogger extends AutomaticBean implements AuditListener

Simple plain logger for text output. This is maybe not very suitable for a text output into a file since it does not need all 'audit finished' and so on stuff, but it looks good on stdout anyway. If there is really a problem this is what XMLLogger is for. It gives structure.

Author: Stephane Bailliez

See Also: XMLLogger

Constructor Summary
DefaultLogger(OutputStream aOS, boolean aCloseStreamsAfterUse)
Creates a new DefaultLogger instance.
DefaultLogger(OutputStream aInfoStream, boolean aCloseInfoAfterUse, OutputStream aErrorStream, boolean aCloseErrorAfterUse)
Creates a new DefaultLogger instance.
Method Summary
voidaddError(AuditEvent aEvt)
Print an Emacs compliant line on the error stream.
voidaddException(AuditEvent aEvt, Throwable aThrowable)
{@inheritDoc}
voidauditFinished(AuditEvent aEvt)
{@inheritDoc}
voidauditStarted(AuditEvent aEvt)
{@inheritDoc}
protected voidcloseStreams()
Flushes the output streams and closes them if needed.
voidfileFinished(AuditEvent aEvt)
{@inheritDoc}
voidfileStarted(AuditEvent aEvt)
{@inheritDoc}

Constructor Detail

DefaultLogger

public DefaultLogger(OutputStream aOS, boolean aCloseStreamsAfterUse)
Creates a new DefaultLogger instance.

Parameters: aOS where to log infos and errors aCloseStreamsAfterUse if aOS should be closed in auditFinished()

DefaultLogger

public DefaultLogger(OutputStream aInfoStream, boolean aCloseInfoAfterUse, OutputStream aErrorStream, boolean aCloseErrorAfterUse)
Creates a new DefaultLogger instance.

Parameters: aInfoStream the OutputStream for info messages aCloseInfoAfterUse auditFinished should close aInfoStream aErrorStream the OutputStream for error messages aCloseErrorAfterUse auditFinished should close aErrorStream

Method Detail

addError

public void addError(AuditEvent aEvt)
Print an Emacs compliant line on the error stream. If the column number is non zero, then also display it.

Parameters: aEvt {@inheritDoc}

See Also:

addException

public void addException(AuditEvent aEvt, Throwable aThrowable)
{@inheritDoc}

auditFinished

public void auditFinished(AuditEvent aEvt)
{@inheritDoc}

auditStarted

public void auditStarted(AuditEvent aEvt)
{@inheritDoc}

closeStreams

protected void closeStreams()
Flushes the output streams and closes them if needed.

fileFinished

public void fileFinished(AuditEvent aEvt)
{@inheritDoc}

fileStarted

public void fileStarted(AuditEvent aEvt)
{@inheritDoc}