Package org.refcodes.logger.alt.console
Class ConsoleLoggerImpl
- java.lang.Object
-
- org.refcodes.logger.alt.console.FormattedLoggerImpl<java.lang.Object>
-
- org.refcodes.logger.alt.console.ConsoleLoggerImpl
-
- All Implemented Interfaces:
ConsoleLogger
,FormattedLogger<java.lang.Object>
,org.refcodes.logger.ColumnLayoutAccessor
,org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutBuilder<java.lang.Object>
,org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutMutator
,org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutProperty
,org.refcodes.logger.LogDecorator
,org.refcodes.logger.Logger<java.lang.Object>
,org.refcodes.mixin.ErrorPrintStreamAccessor
,org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamBuilder<java.lang.Object>
,org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator
,org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamProperty
,org.refcodes.mixin.RowWidthAccessor
,org.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<java.lang.Object>
,org.refcodes.mixin.RowWidthAccessor.RowWidthMutator
,org.refcodes.mixin.RowWidthAccessor.RowWidthProperty
,org.refcodes.mixin.StandardPrintStreamAccessor
,org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamBuilder<java.lang.Object>
,org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamMutator
,org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamProperty
,org.refcodes.textual.TableStyleAccessor
,org.refcodes.textual.TableStyleAccessor.TableStyleBuilder<java.lang.Object>
,org.refcodes.textual.TableStyleAccessor.TableStyleMutator
,org.refcodes.textual.TableStyleAccessor.TableStyleProperty
public class ConsoleLoggerImpl extends FormattedLoggerImpl<java.lang.Object> implements ConsoleLogger
Specialized subclass of theFormattedLoggerImpl
for handlingRuntimeLogger
's logs with ANSI Escape-Codes.
-
-
Nested Class Summary
-
Nested 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.ColumnLayoutProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.Destroyable
org.refcodes.component.Destroyable.DestroyAutomaton
-
Nested 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.ErrorPrintStreamProperty
-
Nested classes/interfaces inherited from class org.refcodes.logger.alt.console.FormattedLoggerImpl
FormattedLoggerImpl.OutputPrintStream
-
Nested 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.RowWidthProperty
-
Nested 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.StandardPrintStreamProperty
-
Nested 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
Fields Modifier and Type Field Description protected org.refcodes.textual.TableBuilder
_errorBuilder
protected org.refcodes.textual.TableBuilder
_standardBuilder
protected org.refcodes.tabular.FormattedHeader<java.lang.Object>
_standardHeader
-
Fields inherited from class org.refcodes.logger.alt.console.FormattedLoggerImpl
_errStream, _hasLeftBorder, _hasLogLines, _hasRightBorder, _header, _isPrintHead, _isPrintSeparator, _rowWidth, _stdStream, _tableBuilder, _tableStyle, DEFAULT_ANSI_BOX_GRID_COLOR
-
-
Constructor Summary
Constructors Constructor Description ConsoleLoggerImpl()
Instantiates a new console logger impl.ConsoleLoggerImpl(org.refcodes.logger.ColumnLayout aLoggerLayout)
Instantiates a new console logger impl.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.refcodes.logger.ColumnLayout
getColumnLayout()
protected void
init()
Inits the logger.void
log(org.refcodes.tabular.Record<? extends java.lang.Object> aRecord)
protected void
printException(java.lang.Throwable theException)
Prints the exception.void
printTail()
void
setColumnLayout(org.refcodes.logger.ColumnLayout aColumnLayout)
protected static org.refcodes.logger.ColumnLayout
toLoggerLayout()
To logger layout.protected static org.refcodes.logger.ColumnLayout
toLoggerLayout(org.refcodes.logger.ColumnLayout aLoggerLayout)
Determines theColumnLayout
by evaluating theSystemProperty.LOGGER_LAYOUT
and theEnvironmentVariable.LOGGER_LAYOUT
(in this order).protected static org.refcodes.textual.TableStyle
toShortcutLoggerStyle()
Determines theTableStyle
by evaluating theSystemProperty.LOGGER_STYLE
and theEnvironmentVariable.LOGGER_STYLE
(in this order).-
Methods inherited from interface org.refcodes.logger.alt.console.ConsoleLogger
setLoggerLayout, withColumnLayout, withErrorPrintStream, withEscapeCodes, withLeftBorder, withRightBorder, withRowWidth, withStandardPrintStream, withTableStyle
-
Methods inherited from interface org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator
setErrorPrintStream
-
Methods inherited from interface org.refcodes.logger.alt.console.FormattedLogger
hasEscapeCodes, hasLeftBorder, hasRightBorder, setEscapeCodes, setLeftBorder, setLoggerStyle, setRightBorder
-
Methods inherited from class org.refcodes.logger.alt.console.FormattedLoggerImpl
destroy, getErrorPrintStream, getRowWidth, getStandardPrintStream, getTableStyle, hasEscapeCodes, hasLeftBorder, hasRightBorder, log, printHead, printSeparator, setErrorPrintStream, setEscapeCodes, setLeftBorder, setLoggerStyle, setRightBorder, setRowWidth, setStandardPrintStream, setTableStyle, toPreConfiguredTableBuilder
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.refcodes.mixin.StandardPrintStreamAccessor
getStandardPrintStream
-
-
-
-
Method Detail
-
getColumnLayout
public org.refcodes.logger.ColumnLayout getColumnLayout()
- Specified by:
getColumnLayout
in interfaceorg.refcodes.logger.ColumnLayoutAccessor
-
setColumnLayout
public void setColumnLayout(org.refcodes.logger.ColumnLayout aColumnLayout)
- Specified by:
setColumnLayout
in interfaceorg.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutMutator
-
log
public void log(org.refcodes.tabular.Record<? extends java.lang.Object> aRecord) throws org.refcodes.logger.IllegalRecordRuntimeException, org.refcodes.logger.UnexpectedLogRuntimeException
- Specified by:
log
in interfaceorg.refcodes.logger.Logger<java.lang.Object>
- Overrides:
log
in classFormattedLoggerImpl<java.lang.Object>
- Throws:
org.refcodes.logger.IllegalRecordRuntimeException
org.refcodes.logger.UnexpectedLogRuntimeException
-
printTail
public void printTail()
- Specified by:
printTail
in interfaceorg.refcodes.logger.LogDecorator
- Overrides:
printTail
in classFormattedLoggerImpl<java.lang.Object>
-
toLoggerLayout
protected static org.refcodes.logger.ColumnLayout toLoggerLayout(org.refcodes.logger.ColumnLayout aLoggerLayout)
Determines theColumnLayout
by evaluating theSystemProperty.LOGGER_LAYOUT
and theEnvironmentVariable.LOGGER_LAYOUT
(in this order). If none (valid) layout was determinable, then theColumnLayout.SUPERUSER
is returned.- Parameters:
aLoggerLayout
- the logger layout- Returns:
- The
ColumnLayout
to 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 theTableStyle
by evaluating theSystemProperty.LOGGER_STYLE
and theEnvironmentVariable.LOGGER_STYLE
(in this order). If none (valid) style was determinable, then a proposed style is returned.- Returns:
- The
TableStyle
to be used.
-
printException
protected void printException(java.lang.Throwable theException)
Prints the exception.- Parameters:
theException
- the the exception
-
init
protected void init()
Inits the logger.- Overrides:
init
in classFormattedLoggerImpl<java.lang.Object>
-
-