Package com.puppycrawl.tools.checkstyle
Class XMLLogger
java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.XMLLogger
- All Implemented Interfaces:
AuditListener,Configurable,Contextualizable,EventListener
Simple XML logger.
It outputs everything in UTF-8 (default XML encoding is UTF-8) in case
we want to localize error messages or simply that file names are
localized and takes care about escaping as well.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
AutomaticBean.OutputStreamOptions -
Constructor Summary
ConstructorsConstructorDescriptionXMLLogger(OutputStream outputStream, AutomaticBean.OutputStreamOptions outputStreamOptions) Creates a newXMLLoggerinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddError(AuditEvent event) Notify that an audit error was discovered on a specific file.voidaddException(AuditEvent event, Throwable throwable) Notify that an exception happened while performing audit.voidauditFinished(AuditEvent event) Notify that the audit is finished.voidauditStarted(AuditEvent event) Notify that the audit is about to start.static StringEscape <, > & ' and " as their entities.voidfileFinished(AuditEvent event) Notify that audit is finished on a specific file.voidfileStarted(AuditEvent event) Notify that audit is about to start on a specific file.protected voidProvides a hook to finish the part of this component's setup that was not handled by the bean introspection.static booleanisReference(String ent) Finds whether the given argument is character or entity reference.Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration, setupChild
-
Constructor Details
-
XMLLogger
Creates a newXMLLoggerinstance. Sets the output to a defined stream.- Parameters:
outputStream- the stream to write logs to.outputStreamOptions- ifCLOSEstream should be closed in auditFinished()
-
-
Method Details
-
finishLocalSetup
protected void finishLocalSetup()Description copied from class:AutomaticBeanProvides a hook to finish the part of this component's setup that was not handled by the bean introspection.The default implementation does nothing.
- Specified by:
finishLocalSetupin classAutomaticBean
-
auditStarted
Description copied from interface:AuditListenerNotify that the audit is about to start.- Specified by:
auditStartedin interfaceAuditListener- Parameters:
event- the event details
-
auditFinished
Description copied from interface:AuditListenerNotify that the audit is finished.- Specified by:
auditFinishedin interfaceAuditListener- Parameters:
event- the event details
-
fileStarted
Description copied from interface:AuditListenerNotify that audit is about to start on a specific file.- Specified by:
fileStartedin interfaceAuditListener- Parameters:
event- the event details
-
fileFinished
Description copied from interface:AuditListenerNotify that audit is finished on a specific file.- Specified by:
fileFinishedin interfaceAuditListener- Parameters:
event- the event details
-
addError
Description copied from interface:AuditListenerNotify that an audit error was discovered on a specific file.- Specified by:
addErrorin interfaceAuditListener- Parameters:
event- the event details
-
addException
Description copied from interface:AuditListenerNotify that an exception happened while performing audit.- Specified by:
addExceptionin interfaceAuditListener- Parameters:
event- the event detailsthrowable- details of the exception
-
encode
Escape <, > & ' and " as their entities.- Parameters:
value- the value to escape.- Returns:
- the escaped value if necessary.
-
isReference
Finds whether the given argument is character or entity reference.- Parameters:
ent- the possible entity to look for.- Returns:
- whether the given argument a character or entity reference
-