Package org.refcodes.logger.alt.console
Class ConsoleLoggerSingleton
java.lang.Object
org.refcodes.logger.alt.console.AbstractConsoleLogger<Object>
org.refcodes.logger.alt.console.ConsoleLogger
org.refcodes.logger.alt.console.ConsoleLoggerSingleton
- 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
This
ConsoleLoggerSingleton
provides a ConsoleLogger
singleton .-
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
Fields inherited from class org.refcodes.logger.alt.console.ConsoleLogger
_errorBuilder, _standardBuilder, _standardHeader
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
ConstructorDescriptionConstructor for constructing a pseudo singleton; this constructor is public to provide means to some configuration frameworks (such as commons-configurations from Apache) for using thisConsoleLoggerSingleton
even when not being able to access thegetInstance()
method. -
Method Summary
Modifier and TypeMethodDescriptionorg.refcodes.logger.ColumnLayout
static ConsoleLogger
Returns the singleton's instance as fabricated by thisConsoleLoggerSingleton
.int
org.refcodes.textual.TableStyle
boolean
Checks for escape codes.boolean
Checks for left border.boolean
Checks for right border.void
void
void
void
void
setColumnLayout
(org.refcodes.logger.ColumnLayout aColumnLayout) void
setErrorPrintStream
(PrintStream aErrStream) void
setEscapeCodes
(boolean isEscCodesEnabled) Sets the escape codes.void
Convenience method forConsoleLogger.setLoggerLayout(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
setLeftBorder
(boolean hasLeftBorder) Sets the left border.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.void
setLoggerStyle
(String aTableStyleName) As the underlying configuration framework used by theRuntimeLoggerSingleton
cannot convert a String to an enum, we got to provide such a method ourselves.void
setRightBorder
(boolean hasRightBorder) Sets the right border.void
setRowWidth
(int aRowWidth) void
setStandardPrintStream
(PrintStream aOutStream) void
setTableStyle
(org.refcodes.textual.TableStyle aTableStyle) withErrorPrintStream
(PrintStream aErrStream) withEscapeCodes
(boolean isEscCodesEnabled) With escape codes.withLeftBorder
(boolean hasLeftBorder) With left border.withRightBorder
(boolean hasRightBorder) With right border.withRowWidth
(int aRowWidth) withStandardPrintStream
(PrintStream aOutStream) withTableStyle
(org.refcodes.textual.TableStyle aTableStyle) Methods inherited from class org.refcodes.logger.alt.console.ConsoleLogger
init, printException, toLoggerLayout, toLoggerLayout, toShortcutLoggerStyle, withColumnLayout
Methods inherited from class org.refcodes.logger.alt.console.AbstractConsoleLogger
destroy, log, setStyle, 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
-
Constructor Details
-
ConsoleLoggerSingleton
public ConsoleLoggerSingleton()Constructor for constructing a pseudo singleton; this constructor is public to provide means to some configuration frameworks (such as commons-configurations from Apache) for using thisConsoleLoggerSingleton
even when not being able to access thegetInstance()
method. The instance overhead for providing singleton behavior is taken into account.
-
-
Method Details
-
getInstance
public static ConsoleLogger getInstance() throws org.refcodes.logger.LoggerInstantiationRuntimeExceptionReturns the singleton's instance as fabricated by thisConsoleLoggerSingleton
.- Returns:
- The
RuntimeLogger
singleton's instance. - Throws:
org.refcodes.logger.LoggerInstantiationRuntimeException
- Thrown in case instantiating aLogger
(RuntimeLogger
) failed
-
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 classConsoleLogger
- Throws:
org.refcodes.logger.IllegalRecordRuntimeException
org.refcodes.logger.UnexpectedLogRuntimeException
-
getStandardPrintStream
- Specified by:
getStandardPrintStream
in interfaceorg.refcodes.mixin.StandardPrintStreamAccessor
- Overrides:
getStandardPrintStream
in classAbstractConsoleLogger<Object>
-
setStandardPrintStream
- Specified by:
setStandardPrintStream
in interfaceorg.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamMutator
- Overrides:
setStandardPrintStream
in classAbstractConsoleLogger<Object>
-
getErrorPrintStream
- Specified by:
getErrorPrintStream
in interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor
- Overrides:
getErrorPrintStream
in classAbstractConsoleLogger<Object>
-
setErrorPrintStream
- Specified by:
setErrorPrintStream
in interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator
- Overrides:
setErrorPrintStream
in classAbstractConsoleLogger<Object>
-
getTableStyle
public org.refcodes.textual.TableStyle getTableStyle()- Specified by:
getTableStyle
in interfaceorg.refcodes.textual.TableStyleAccessor
- Overrides:
getTableStyle
in classAbstractConsoleLogger<Object>
-
setTableStyle
public void setTableStyle(org.refcodes.textual.TableStyle aTableStyle) - Specified by:
setTableStyle
in interfaceorg.refcodes.textual.TableStyleAccessor.TableStyleMutator
- Overrides:
setTableStyle
in classAbstractConsoleLogger<Object>
-
setLoggerStyle
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 useAbstractConsoleLogger.setTableStyle(TableStyle)
, when using the "runtimelogger-config.xml
" use the property "loggerStyle" for this method to be invoked. Valid arguments are as of theTableStyle
enumeration:- SINGLE_HEADER_SINGLE_BODY
- DOUBLE_SINGLE_HEADER_SINGLE_BODY
- DOUBLE_HEADER_DOUBLE_BODY
- DOUBLE_SINGLE_HEADER_DOUBLE_SINGLE_BODY
- DOUBLE_HEADER_SINGLE_BODY
- DOUBLE_HEADER_DOUBLE_SINGLE_BODY
- DOUBLE_SINGLE_HEADER_SINGLE_DASHED_BODY
- ASCII_HEADER_ASCII_BODY
- BLANK_HEADER_BLANK_BODY
- SINGLE_BLANK_HEADER_SINGLE_BLANK_BODY
- ASCII_BLANK_HEADER_ASCII_BLANK_BODY
- Overrides:
setLoggerStyle
in classAbstractConsoleLogger<Object>
- Parameters:
aTableStyleName
- The style to use for the logger.
-
setEscapeCodes
public void setEscapeCodes(boolean isEscCodesEnabled) Sets the escape codes.- Overrides:
setEscapeCodes
in classAbstractConsoleLogger<Object>
- Parameters:
isEscCodesEnabled
- the new escape codes
-
hasLeftBorder
public boolean hasLeftBorder()Checks for left border.- Overrides:
hasLeftBorder
in classAbstractConsoleLogger<Object>
- Returns:
- true, if successful
-
setLeftBorder
public void setLeftBorder(boolean hasLeftBorder) Sets the left border.- Overrides:
setLeftBorder
in classAbstractConsoleLogger<Object>
- Parameters:
hasLeftBorder
- the new left border
-
hasRightBorder
public boolean hasRightBorder()Checks for right border.- Overrides:
hasRightBorder
in classAbstractConsoleLogger<Object>
- Returns:
- true, if successful
-
setRightBorder
public void setRightBorder(boolean hasRightBorder) Sets the right border.- Overrides:
setRightBorder
in classAbstractConsoleLogger<Object>
- Parameters:
hasRightBorder
- the new right border
-
getRowWidth
public int getRowWidth()- Specified by:
getRowWidth
in interfaceorg.refcodes.mixin.RowWidthAccessor
- Overrides:
getRowWidth
in classAbstractConsoleLogger<Object>
-
setRowWidth
public void setRowWidth(int aRowWidth) - Specified by:
setRowWidth
in interfaceorg.refcodes.mixin.RowWidthAccessor.RowWidthMutator
- Overrides:
setRowWidth
in classAbstractConsoleLogger<Object>
-
printHead
public void printHead()- Specified by:
printHead
in interfaceorg.refcodes.logger.LogDecorator
- Overrides:
printHead
in classAbstractConsoleLogger<Object>
-
printSeparator
public void printSeparator()- Specified by:
printSeparator
in interfaceorg.refcodes.logger.LogDecorator
- Overrides:
printSeparator
in classAbstractConsoleLogger<Object>
-
printTail
public void printTail()- Specified by:
printTail
in interfaceorg.refcodes.logger.LogDecorator
- Overrides:
printTail
in classConsoleLogger
-
withStandardPrintStream
- Specified by:
withStandardPrintStream
in interfaceorg.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamBuilder<AbstractConsoleLogger<Object>>
- Overrides:
withStandardPrintStream
in classConsoleLogger
-
withErrorPrintStream
- Specified by:
withErrorPrintStream
in interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamBuilder<AbstractConsoleLogger<Object>>
- Overrides:
withErrorPrintStream
in classConsoleLogger
-
withTableStyle
- Specified by:
withTableStyle
in interfaceorg.refcodes.textual.TableStyleAccessor.TableStyleBuilder<AbstractConsoleLogger<?>>
- Overrides:
withTableStyle
in classConsoleLogger
-
withEscapeCodes
With escape codes.- Overrides:
withEscapeCodes
in classConsoleLogger
- Parameters:
isEscCodesEnabled
- the is esc codes enabled- Returns:
- the formatted logger
-
withLeftBorder
With left border.- Overrides:
withLeftBorder
in classConsoleLogger
- Parameters:
hasLeftBorder
- the has left border- Returns:
- the formatted logger
-
withRightBorder
With right border.- Overrides:
withRightBorder
in classConsoleLogger
- Parameters:
hasRightBorder
- the has right border- Returns:
- the formatted logger
-
withRowWidth
- Specified by:
withRowWidth
in interfaceorg.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<AbstractConsoleLogger<?>>
- Overrides:
withRowWidth
in classConsoleLogger
-
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 useConsoleLogger.setColumnLayout(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
- Overrides:
setLoggerLayout
in classConsoleLogger
- Parameters:
aLoggerLayout
- the new logger layout
-
setLayout
Convenience method forConsoleLogger.setLoggerLayout(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 useConsoleLogger.setColumnLayout(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
- Overrides:
setLayout
in classConsoleLogger
- Parameters:
aLoggerLayout
- the new logger layout
-
hasEscapeCodes
public boolean hasEscapeCodes()Checks for escape codes.- Overrides:
hasEscapeCodes
in classAbstractConsoleLogger<Object>
- Returns:
- true, if successful
-
getColumnLayout
public org.refcodes.logger.ColumnLayout getColumnLayout()- Specified by:
getColumnLayout
in interfaceorg.refcodes.logger.ColumnLayoutAccessor
- Overrides:
getColumnLayout
in classConsoleLogger
-
setColumnLayout
public void setColumnLayout(org.refcodes.logger.ColumnLayout aColumnLayout) - Specified by:
setColumnLayout
in interfaceorg.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutMutator
- Overrides:
setColumnLayout
in classConsoleLogger
-