Class AbstractStyleNameConverter
- java.lang.Object
-
- org.apache.logging.log4j.core.pattern.AbstractPatternConverter
-
- org.apache.logging.log4j.core.pattern.LogEventPatternConverter
-
- org.apache.logging.log4j.core.pattern.AbstractStyleNameConverter
-
- All Implemented Interfaces:
PatternConverter
- Direct Known Subclasses:
AbstractStyleNameConverter.Black,AbstractStyleNameConverter.Blue,AbstractStyleNameConverter.Cyan,AbstractStyleNameConverter.Green,AbstractStyleNameConverter.Magenta,AbstractStyleNameConverter.Red,AbstractStyleNameConverter.White,AbstractStyleNameConverter.Yellow
public abstract class AbstractStyleNameConverter extends LogEventPatternConverter
Style pattern converter. Adds ANSI color styling to the result of the enclosed pattern.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractStyleNameConverter.BlackBlack style pattern converter.static classAbstractStyleNameConverter.BlueBlue style pattern converter.static classAbstractStyleNameConverter.CyanCyan style pattern converter.static classAbstractStyleNameConverter.GreenGreen style pattern converter.static classAbstractStyleNameConverter.MagentaMagenta style pattern converter.static classAbstractStyleNameConverter.RedRed style pattern converter.static classAbstractStyleNameConverter.WhiteWhite style pattern converter.static classAbstractStyleNameConverter.YellowYellow style pattern converter.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<PatternFormatter>formattersprivate java.lang.Stringstyle-
Fields inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter
LOGGER
-
Fields inherited from interface org.apache.logging.log4j.core.pattern.PatternConverter
CATEGORY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractStyleNameConverter(java.lang.String name, java.util.List<PatternFormatter> formatters, java.lang.String styling)Constructs the converter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidformat(LogEvent event, java.lang.StringBuilder toAppendTo)Formats an event into a string buffer.protected static <T extends AbstractStyleNameConverter>
TnewInstance(java.lang.Class<T> asnConverterClass, java.lang.String name, Configuration config, java.lang.String[] options)Gets an instance of the class (called via reflection).private static java.util.List<PatternFormatter>toPatternFormatterList(Configuration config, java.lang.String[] options)Creates a list of PatternFormatter from the given configuration and options or null if no pattern is supplied.-
Methods inherited from class org.apache.logging.log4j.core.pattern.LogEventPatternConverter
format, handlesThrowable, isVariable
-
Methods inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter
getName, getStyleClass
-
-
-
-
Field Detail
-
formatters
private final java.util.List<PatternFormatter> formatters
-
style
private final java.lang.String style
-
-
Constructor Detail
-
AbstractStyleNameConverter
protected AbstractStyleNameConverter(java.lang.String name, java.util.List<PatternFormatter> formatters, java.lang.String styling)Constructs the converter.- Parameters:
formatters- The PatternFormatters to generate the text to manipulate.styling- The styling that should encapsulate the pattern.
-
-
Method Detail
-
newInstance
protected static <T extends AbstractStyleNameConverter> T newInstance(java.lang.Class<T> asnConverterClass, java.lang.String name, Configuration config, java.lang.String[] options)
Gets an instance of the class (called via reflection).- Parameters:
config- The current Configuration.options- The pattern options, may be null. If the first element is "short", only the first line of the throwable will be formatted.- Returns:
- new instance of class or null
-
toPatternFormatterList
private static java.util.List<PatternFormatter> toPatternFormatterList(Configuration config, java.lang.String[] options)
Creates a list of PatternFormatter from the given configuration and options or null if no pattern is supplied.- Parameters:
config- A configuration.options- pattern options.- Returns:
- a list of PatternFormatter from the given configuration and options or null if no pattern is supplied.
-
format
public void format(LogEvent event, java.lang.StringBuilder toAppendTo)
Formats an event into a string buffer.- Specified by:
formatin classLogEventPatternConverter- Parameters:
event- event to format, may not be null.toAppendTo- string buffer to which the formatted event will be appended. May not be null.
-
-