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
Modifier and TypeFieldDescriptionprivate static final int
Length of all separators.private static final String
Suffix of module names like XXXXCheck. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionformat
(AuditEvent event) Formats an event message.private static String
getCheckShortName
(AuditEvent event) Returns check name without 'Check' suffix.private static StringBuilder
initStringBuilderWithOptimalBuffer
(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:AuditEventFormatter
Formats an event message.- Specified by:
format
in 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.
-