Package com.puppycrawl.tools.checkstyle
Class AuditEventDefaultFormatter
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.AuditEventDefaultFormatter
-
- All Implemented Interfaces:
AuditEventFormatter
public class AuditEventDefaultFormatter extends Object implements 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
Fields Modifier and Type Field Description private static int
LENGTH_OF_ALL_SEPARATORS
Length of all separators.private static String
SUFFIX
Suffix of module names like XXXXCheck.
-
Constructor Summary
Constructors Constructor Description AuditEventDefaultFormatter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(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 Detail
-
LENGTH_OF_ALL_SEPARATORS
private static final int LENGTH_OF_ALL_SEPARATORS
Length of all separators.- See Also:
- Constant Field Values
-
SUFFIX
private static final String SUFFIX
Suffix of module names like XXXXCheck.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AuditEventDefaultFormatter
public AuditEventDefaultFormatter()
-
-
Method Detail
-
format
public String format(AuditEvent event)
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
private static String getCheckShortName(AuditEvent event)
Returns check name without 'Check' suffix.- Parameters:
event
- audit event.- Returns:
- check name without 'Check' suffix.
-
-