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.OutputPrintStream
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 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
Modifier and TypeFieldDescriptionprotected org.refcodes.textual.TableBuilder
protected org.refcodes.textual.TableBuilder
protected 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
ConstructorDescriptionInstantiates a new console logger impl.ConsoleLogger
(org.refcodes.logger.ColumnLayout aLoggerLayout) Instantiates a new console logger impl. -
Method Summary
Modifier and TypeMethodDescriptionorg.refcodes.logger.ColumnLayout
protected void
init()
Inits the logger.void
protected void
printException
(Throwable theException) Prints the exception.void
void
setColumnLayout
(org.refcodes.logger.ColumnLayout aColumnLayout) void
Convenience method forsetLoggerLayout(String)
: As the underlying configuration framework used by theRuntimeLoggerSingleton
cannot convert a String to an enum, we got to provide such a method ourselves.void
setLoggerLayout
(String aLoggerLayout) As the underlying configuration framework used by theRuntimeLoggerSingleton
cannot convert a String to an enum, we got to provide such a method ourselves.protected static org.refcodes.logger.ColumnLayout
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
Determines theTableStyle
by evaluating theSystemProperty.LOGGER_STYLE
and 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, 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.logger.ColumnLayoutAccessor.ColumnLayoutProperty
letColumnLayout
Methods inherited from interface org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamProperty
letErrorPrintStream
Methods inherited from interface org.refcodes.mixin.RowWidthAccessor.RowWidthProperty
letRowWidth
Methods inherited from interface org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamProperty
letStandardPrintStream
Methods 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:
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 Object> aRecord) throws org.refcodes.logger.IllegalRecordRuntimeException, org.refcodes.logger.UnexpectedLogRuntimeException - Specified by:
log
in interfaceorg.refcodes.logger.Logger<Object>
- Overrides:
log
in classAbstractConsoleLogger<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 classAbstractConsoleLogger<Object>
-
withColumnLayout
- Specified by:
withColumnLayout
in interfaceorg.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutBuilder<ConsoleLogger>
-
withTableStyle
- Specified by:
withTableStyle
in interfaceorg.refcodes.textual.TableStyleAccessor.TableStyleBuilder<AbstractConsoleLogger<?>>
- Overrides:
withTableStyle
in classAbstractConsoleLogger<Object>
-
withRowWidth
- Specified by:
withRowWidth
in interfaceorg.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<AbstractConsoleLogger<?>>
- Overrides:
withRowWidth
in classAbstractConsoleLogger<Object>
-
withEscapeCodes
With escape codes.- Overrides:
withEscapeCodes
in classAbstractConsoleLogger<Object>
- Parameters:
isEscCodesEnabled
- the is esc codes enabled- Returns:
- the formatted logger
-
withLeftBorder
With left border.- Overrides:
withLeftBorder
in classAbstractConsoleLogger<Object>
- Parameters:
hasLeftBorder
- the has left border- Returns:
- the formatted logger
-
withRightBorder
With right border.- Overrides:
withRightBorder
in classAbstractConsoleLogger<Object>
- Parameters:
hasRightBorder
- the has right border- Returns:
- the formatted logger
-
withErrorPrintStream
- Specified by:
withErrorPrintStream
in interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamBuilder<AbstractConsoleLogger<Object>>
- Overrides:
withErrorPrintStream
in classAbstractConsoleLogger<Object>
-
withStandardPrintStream
- Specified by:
withStandardPrintStream
in interfaceorg.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamBuilder<AbstractConsoleLogger<Object>>
- Overrides:
withStandardPrintStream
in classAbstractConsoleLogger<Object>
-
setLoggerLayout
As the underlying configuration framework used by theRuntimeLoggerSingleton
cannot 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 theColumnLayout
enumeration:- 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 theRuntimeLoggerSingleton
cannot 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 theColumnLayout
enumeration:- 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 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
Prints the exception.- Parameters:
theException
- the the exception
-
init
protected void init()Inits the logger.- Overrides:
init
in classAbstractConsoleLogger<Object>
-