Package com.puppycrawl.tools.checkstyle
Class AuditEventDefaultFormatter
java.lang.Object
com.puppycrawl.tools.checkstyle.AuditEventDefaultFormatter
- All Implemented Interfaces:
AuditEventFormatter
Represents the default formatter for log message.
Default log message format is:
[SEVERITY LEVEL] filePath:lineNo:columnNo: message. [CheckName]
When the module id of the message has been set, the format is:
[SEVERITY LEVEL] filePath:lineNo:columnNo: message. [ModuleId]
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intLength of all separators.private static final StringSuffix of module names like XXXXCheck. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionformat(AuditEvent event) Formats an event message.private static StringgetCheckShortName(AuditEvent event) Returns check name without 'Check' suffix.private static StringBuilderinitStringBuilderWithOptimalBuffer(AuditEvent event, String severityLevelName) Returns the StringBuilder that should avoid StringBuffer.expandCapacity.
-
Field Details
-
LENGTH_OF_ALL_SEPARATORS
Length of all separators.- See Also:
-
SUFFIX
Suffix of module names like XXXXCheck.- See Also:
-
-
Constructor Details
-
AuditEventDefaultFormatter
public AuditEventDefaultFormatter()
-
-
Method Details
-
format
Description copied from interface:AuditEventFormatterFormats an event message.- Specified by:
formatin interfaceAuditEventFormatter- Parameters:
event- audit event.- Returns:
- string representation of event message.
-
initStringBuilderWithOptimalBuffer
private static StringBuilder initStringBuilderWithOptimalBuffer(AuditEvent event, String severityLevelName) Returns the StringBuilder that should avoid StringBuffer.expandCapacity. bufferLength = fileNameLength + messageLength + lengthOfAllSeparators + + severityNameLength + checkNameLength. Method is excluded from pitest validation.- Parameters:
event- audit event.severityLevelName- severity level name.- Returns:
- optimal StringBuilder.
-
getCheckShortName
Returns check name without 'Check' suffix.- Parameters:
event- audit event.- Returns:
- check name without 'Check' suffix.
-