java.lang.Object
org.refcodes.logger.alt.console.AbstractConsoleLogger<Object>
org.refcodes.logger.alt.console.ConsoleLogger
- All Implemented Interfaces:
org.refcodes.component.Destroyable,org.refcodes.logger.ColumnLayoutAccessor,org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutBuilder<ConsoleLogger>,org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutMutator,org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutProperty,org.refcodes.logger.LogDecorator,org.refcodes.logger.Logger<Object>,org.refcodes.mixin.ErrorPrintStreamAccessor,org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamBuilder<AbstractConsoleLogger<Object>>,org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator,org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamProperty,org.refcodes.mixin.RowWidthAccessor,org.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<AbstractConsoleLogger<?>>,org.refcodes.mixin.RowWidthAccessor.RowWidthMutator,org.refcodes.mixin.RowWidthAccessor.RowWidthProperty,org.refcodes.mixin.StandardPrintStreamAccessor,org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamBuilder<AbstractConsoleLogger<Object>>,org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamMutator,org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamProperty,org.refcodes.textual.TableStyleAccessor,org.refcodes.textual.TableStyleAccessor.TableStyleBuilder<AbstractConsoleLogger<?>>,org.refcodes.textual.TableStyleAccessor.TableStyleMutator,org.refcodes.textual.TableStyleAccessor.TableStyleProperty
- Direct Known Subclasses:
ConsoleLoggerSingleton
public class ConsoleLogger
extends AbstractConsoleLogger<Object>
implements org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutProperty, org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutBuilder<ConsoleLogger>
Specialized subclass of the
AbstractConsoleLogger for handling
RuntimeLogger's logs with ANSI Escape-Codes.-
Nested Class Summary
Nested classes/interfaces inherited from class org.refcodes.logger.alt.console.AbstractConsoleLogger
AbstractConsoleLogger.OutputPrintStreamNested classes/interfaces inherited from interface org.refcodes.logger.ColumnLayoutAccessor
org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutBuilder<B extends org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutBuilder<B>>, org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutMutator, org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutPropertyNested classes/interfaces inherited from interface org.refcodes.component.Destroyable
org.refcodes.component.Destroyable.DestroyAutomatonNested classes/interfaces inherited from interface org.refcodes.mixin.ErrorPrintStreamAccessor
org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamBuilder<B extends org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamBuilder<?>>, org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator, org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.RowWidthAccessor
org.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<B extends org.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<?>>, org.refcodes.mixin.RowWidthAccessor.RowWidthMutator, org.refcodes.mixin.RowWidthAccessor.RowWidthPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.StandardPrintStreamAccessor
org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamBuilder<B extends org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamBuilder<?>>, org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamMutator, org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamPropertyNested classes/interfaces inherited from interface org.refcodes.textual.TableStyleAccessor
org.refcodes.textual.TableStyleAccessor.TableStyleBuilder<B extends org.refcodes.textual.TableStyleAccessor.TableStyleBuilder<?>>, org.refcodes.textual.TableStyleAccessor.TableStyleMutator, org.refcodes.textual.TableStyleAccessor.TableStyleProperty -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.refcodes.textual.TableBuilderprotected org.refcodes.textual.TableBuilderprotected org.refcodes.tabular.FormattedHeader<Object>Fields inherited from class org.refcodes.logger.alt.console.AbstractConsoleLogger
_errStream, _hasLeftBorder, _hasLogLines, _hasRightBorder, _header, _isPrintHead, _isPrintSeparator, _rowWidth, _stdStream, _tableBuilder, _tableStyle, DEFAULT_ANSI_BOX_GRID_COLOR -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new console logger impl.ConsoleLogger(org.refcodes.logger.ColumnLayout aLoggerLayout) Instantiates a new console logger impl. -
Method Summary
Modifier and TypeMethodDescriptionorg.refcodes.logger.ColumnLayoutprotected voidinit()Initializes the logger.voidprotected voidprintException(Throwable theException) Prints the exception.voidvoidsetColumnLayout(org.refcodes.logger.ColumnLayout aColumnLayout) voidConvenience method forsetLoggerLayout(String): As the underlying configuration framework used by theRuntimeLoggerSingletoncannot convert a String to an enum, we got to provide such a method ourselves.voidsetLoggerLayout(String aLoggerLayout) As the underlying configuration framework used by theRuntimeLoggerSingletoncannot convert a String to an enum, we got to provide such a method ourselves.protected static org.refcodes.logger.ColumnLayoutTo logger layout.protected static org.refcodes.logger.ColumnLayouttoLoggerLayout(org.refcodes.logger.ColumnLayout aLoggerLayout) Determines theColumnLayoutby evaluating theSystemProperty.LOGGER_LAYOUTand theEnvironmentVariable.LOGGER_LAYOUT(in this order).protected static org.refcodes.textual.TableStyleDetermines theTableStyleby evaluating theSystemProperty.LOGGER_STYLEand theEnvironmentVariable.LOGGER_STYLE(in this order).withColumnLayout(org.refcodes.logger.ColumnLayout aColumnLayout) withErrorPrintStream(PrintStream aErrorPrintStream) withEscapeCodes(boolean isEscCodesEnabled) With escape codes.withLeftBorder(boolean hasLeftBorder) With left border.withRightBorder(boolean hasRightBorder) With right border.withRowWidth(int aRowWidth) withStandardPrintStream(PrintStream aStandardPrintStream) withTableStyle(org.refcodes.textual.TableStyle aTableStyle) Methods inherited from class org.refcodes.logger.alt.console.AbstractConsoleLogger
destroy, getErrorPrintStream, getRowWidth, getStandardPrintStream, getTableStyle, hasEscapeCodes, hasLeftBorder, hasRightBorder, log, printHead, printSeparator, setErrorPrintStream, setEscapeCodes, setLeftBorder, setLoggerStyle, setRightBorder, setRowWidth, setStandardPrintStream, setStyle, setTableStyle, toPreConfiguredTableBuilderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutProperty
letColumnLayoutMethods inherited from interface org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamProperty
letErrorPrintStreamMethods inherited from interface org.refcodes.mixin.RowWidthAccessor.RowWidthProperty
letRowWidthMethods inherited from interface org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamProperty
letStandardPrintStreamMethods inherited from interface org.refcodes.textual.TableStyleAccessor.TableStyleProperty
letTableStyle
-
Field Details
-
_errorBuilder
protected org.refcodes.textual.TableBuilder _errorBuilder -
_standardBuilder
protected org.refcodes.textual.TableBuilder _standardBuilder -
_standardHeader
-
-
Constructor Details
-
ConsoleLogger
public ConsoleLogger()Instantiates a new console logger impl. -
ConsoleLogger
public ConsoleLogger(org.refcodes.logger.ColumnLayout aLoggerLayout) Instantiates a new console logger impl.- Parameters:
aLoggerLayout- the logger layout
-
-
Method Details
-
getColumnLayout
public org.refcodes.logger.ColumnLayout getColumnLayout()- Specified by:
getColumnLayoutin interfaceorg.refcodes.logger.ColumnLayoutAccessor
-
setColumnLayout
public void setColumnLayout(org.refcodes.logger.ColumnLayout aColumnLayout) - Specified by:
setColumnLayoutin interfaceorg.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutMutator
-
log
- Specified by:
login interfaceorg.refcodes.logger.Logger<Object>- Overrides:
login classAbstractConsoleLogger<Object>
-
printTail
public void printTail()- Specified by:
printTailin interfaceorg.refcodes.logger.LogDecorator- Overrides:
printTailin classAbstractConsoleLogger<Object>
-
withColumnLayout
- Specified by:
withColumnLayoutin interfaceorg.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutBuilder<ConsoleLogger>
-
withTableStyle
- Specified by:
withTableStylein interfaceorg.refcodes.textual.TableStyleAccessor.TableStyleBuilder<AbstractConsoleLogger<?>>- Overrides:
withTableStylein classAbstractConsoleLogger<Object>
-
withRowWidth
- Specified by:
withRowWidthin interfaceorg.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<AbstractConsoleLogger<?>>- Overrides:
withRowWidthin classAbstractConsoleLogger<Object>
-
withEscapeCodes
With escape codes.- Overrides:
withEscapeCodesin classAbstractConsoleLogger<Object>- Parameters:
isEscCodesEnabled- the is esc codes enabled- Returns:
- the formatted logger
-
withLeftBorder
With left border.- Overrides:
withLeftBorderin classAbstractConsoleLogger<Object>- Parameters:
hasLeftBorder- the has left border- Returns:
- the formatted logger
-
withRightBorder
With right border.- Overrides:
withRightBorderin classAbstractConsoleLogger<Object>- Parameters:
hasRightBorder- the has right border- Returns:
- the formatted logger
-
withErrorPrintStream
- Specified by:
withErrorPrintStreamin interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamBuilder<AbstractConsoleLogger<Object>>- Overrides:
withErrorPrintStreamin classAbstractConsoleLogger<Object>
-
withStandardPrintStream
- Specified by:
withStandardPrintStreamin interfaceorg.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamBuilder<AbstractConsoleLogger<Object>>- Overrides:
withStandardPrintStreamin classAbstractConsoleLogger<Object>
-
setLoggerLayout
As the underlying configuration framework used by theRuntimeLoggerSingletoncannot convert a String to an enum, we got to provide such a method ourselves. When configuring programmatically usesetColumnLayout(ColumnLayout), when using the "runtimelogger-config.xml" use the property "loggerLayout" for this method to be invoked. Valid arguments are as of theColumnLayoutenumeration:- GRANDPA
- SUPERUSER
- FALLBACK
- DEVELOPER
- DEVOPS
- ENDUSER
- ANALYST
- Parameters:
aLoggerLayout- the new logger layout
-
setLayout
Convenience method forsetLoggerLayout(String): As the underlying configuration framework used by theRuntimeLoggerSingletoncannot convert a String to an enum, we got to provide such a method ourselves. When configuring programmatically usesetColumnLayout(ColumnLayout), when using the "runtimelogger-config.xml" use the property "loggerLayout" for this method to be invoked. Valid arguments are as of theColumnLayoutenumeration:- GRANDPA
- SUPERUSER
- FALLBACK
- DEVELOPER
- DEVOPS
- ENDUSER
- ANALYST
- Parameters:
aLoggerLayout- the new logger layout
-
toLoggerLayout
protected static org.refcodes.logger.ColumnLayout toLoggerLayout(org.refcodes.logger.ColumnLayout aLoggerLayout) Determines theColumnLayoutby evaluating theSystemProperty.LOGGER_LAYOUTand theEnvironmentVariable.LOGGER_LAYOUT(in this order). If none (valid) layout was determinable, then theColumnLayout.SUPERUSERis returned.- Parameters:
aLoggerLayout- the logger layout- Returns:
- The
ColumnLayoutto be used.
-
toLoggerLayout
protected static org.refcodes.logger.ColumnLayout toLoggerLayout()To logger layout.- Returns:
- the column layout
-
toShortcutLoggerStyle
protected static org.refcodes.textual.TableStyle toShortcutLoggerStyle()Determines theTableStyleby evaluating theSystemProperty.LOGGER_STYLEand theEnvironmentVariable.LOGGER_STYLE(in this order). If none (valid) style was determinable, then a proposed style is returned.- Returns:
- The
TableStyleto be used.
-
printException
Prints the exception.- Parameters:
theException- the the exception
-
init
protected void init()Initializes the logger.- Overrides:
initin classAbstractConsoleLogger<Object>
-