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 int
Length of all separators.private static final String
Suffix of module names like XXXXCheck. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
calculateBufferLength
(AuditEvent event, int severityLevelNameLength) Returns the length of the buffer for StringBuilder.format
(AuditEvent event) Formats an event message.private static String
getCheckShortName
(AuditEvent event) Returns check name without 'Check' suffix.
-
Field Details
-
LENGTH_OF_ALL_SEPARATORS
private static final int LENGTH_OF_ALL_SEPARATORSLength 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.
-
calculateBufferLength
Returns the length of the buffer for StringBuilder. bufferLength = fileNameLength + messageLength + lengthOfAllSeparators + + severityNameLength + checkNameLength.- Parameters:
event
- audit event.severityLevelNameLength
- length of severity level name.- Returns:
- the length of the buffer for StringBuilder.
-
getCheckShortName
Returns check name without 'Check' suffix.- Parameters:
event
- audit event.- Returns:
- check name without 'Check' suffix.
-