Package org.refcodes.logger.alt.console
Class ConsoleLoggerSingleton
- java.lang.Object
-
- org.refcodes.logger.alt.console.ConsoleLoggerSingleton
-
- 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.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 ConsoleLoggerSingleton extends java.lang.Object implements ConsoleLogger
ThisConsoleLoggerSingleton
provides aConsoleLoggerImpl
singleton .
-
-
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.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
-
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.refcodes.logger.ColumnLayout
getColumnLayout()
java.io.PrintStream
getErrorPrintStream()
static ConsoleLoggerImpl
getInstance()
Returns the singleton's instance as fabricated by thisConsoleLoggerSingleton
.int
getRowWidth()
java.io.PrintStream
getStandardPrintStream()
org.refcodes.textual.TableStyle
getTableStyle()
boolean
hasEscapeCodes()
Checks for escape codes.boolean
hasLeftBorder()
Checks for left border.boolean
hasRightBorder()
Checks for right border.void
log(org.refcodes.tabular.Record<? extends java.lang.Object> aRecord)
void
printSeparator()
void
setColumnLayout(org.refcodes.logger.ColumnLayout aColumnLayout)
void
setErrorPrintStream(java.io.PrintStream aErrStream)
void
setEscapeCodes(boolean isEscCodesEnabled)
Sets the escape codes.void
setLeftBorder(boolean hasLeftBorder)
Sets the left border.void
setLoggerLayout(java.lang.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(java.lang.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(java.io.PrintStream aOutStream)
void
setTableStyle(org.refcodes.textual.TableStyle aTableStyle)
ConsoleLoggerSingleton
withErrorPrintStream(java.io.PrintStream aErrStream)
ConsoleLoggerSingleton
withEscapeCodes(boolean isEscCodesEnabled)
With escape codes.ConsoleLoggerSingleton
withLeftBorder(boolean hasLeftBorder)
With left border.ConsoleLoggerSingleton
withRightBorder(boolean hasRightBorder)
With right border.ConsoleLoggerSingleton
withRowWidth(int aRowWidth)
ConsoleLoggerSingleton
withStandardPrintStream(java.io.PrintStream aOutStream)
ConsoleLoggerSingleton
withTableStyle(org.refcodes.textual.TableStyle aTableStyle)
-
Methods inherited from interface org.refcodes.logger.alt.console.ConsoleLogger
withColumnLayout
-
-
-
-
Constructor Detail
-
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 Detail
-
getInstance
public static ConsoleLoggerImpl getInstance() throws org.refcodes.logger.LoggerInstantiationRuntimeException
Returns 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 java.lang.Object> aRecord) throws org.refcodes.logger.IllegalRecordRuntimeException, org.refcodes.logger.UnexpectedLogRuntimeException
- Specified by:
log
in interfaceorg.refcodes.logger.Logger<java.lang.Object>
- Throws:
org.refcodes.logger.IllegalRecordRuntimeException
org.refcodes.logger.UnexpectedLogRuntimeException
-
getStandardPrintStream
public java.io.PrintStream getStandardPrintStream()
- Specified by:
getStandardPrintStream
in interfaceorg.refcodes.mixin.StandardPrintStreamAccessor
-
setStandardPrintStream
public void setStandardPrintStream(java.io.PrintStream aOutStream)
- Specified by:
setStandardPrintStream
in interfaceorg.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamMutator
-
getErrorPrintStream
public java.io.PrintStream getErrorPrintStream()
- Specified by:
getErrorPrintStream
in interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor
-
setErrorPrintStream
public void setErrorPrintStream(java.io.PrintStream aErrStream)
- Specified by:
setErrorPrintStream
in interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator
-
getTableStyle
public org.refcodes.textual.TableStyle getTableStyle()
- Specified by:
getTableStyle
in interfaceorg.refcodes.textual.TableStyleAccessor
-
setTableStyle
public void setTableStyle(org.refcodes.textual.TableStyle aTableStyle)
- Specified by:
setTableStyle
in interfaceorg.refcodes.textual.TableStyleAccessor.TableStyleMutator
-
setLoggerStyle
public void setLoggerStyle(java.lang.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. When configuring programmatically useTableStyleAccessor.TableStyleMutator.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
- DOUBLE
- DOUBLE_SINGLE
- SINGLE_DOUBLE
- SINGLE_DASHED
- ASCII
- BLANK
- SINGLE_BLANK
- ASCII_BLANK
- Specified by:
setLoggerStyle
in interfaceFormattedLogger<java.lang.Object>
- Parameters:
aTableStyleName
- The style to use for the logger.
-
setEscapeCodes
public void setEscapeCodes(boolean isEscCodesEnabled)
Sets the escape codes.- Specified by:
setEscapeCodes
in interfaceFormattedLogger<java.lang.Object>
- Parameters:
isEscCodesEnabled
- the new escape codes
-
hasLeftBorder
public boolean hasLeftBorder()
Checks for left border.- Specified by:
hasLeftBorder
in interfaceFormattedLogger<java.lang.Object>
- Returns:
- true, if successful
-
setLeftBorder
public void setLeftBorder(boolean hasLeftBorder)
Sets the left border.- Specified by:
setLeftBorder
in interfaceFormattedLogger<java.lang.Object>
- Parameters:
hasLeftBorder
- the new left border
-
hasRightBorder
public boolean hasRightBorder()
Checks for right border.- Specified by:
hasRightBorder
in interfaceFormattedLogger<java.lang.Object>
- Returns:
- true, if successful
-
setRightBorder
public void setRightBorder(boolean hasRightBorder)
Sets the right border.- Specified by:
setRightBorder
in interfaceFormattedLogger<java.lang.Object>
- Parameters:
hasRightBorder
- the new right border
-
getRowWidth
public int getRowWidth()
- Specified by:
getRowWidth
in interfaceorg.refcodes.mixin.RowWidthAccessor
-
setRowWidth
public void setRowWidth(int aRowWidth)
- Specified by:
setRowWidth
in interfaceorg.refcodes.mixin.RowWidthAccessor.RowWidthMutator
-
printSeparator
public void printSeparator()
- Specified by:
printSeparator
in interfaceorg.refcodes.logger.Logger<java.lang.Object>
-
withStandardPrintStream
public ConsoleLoggerSingleton withStandardPrintStream(java.io.PrintStream aOutStream)
- Specified by:
withStandardPrintStream
in interfaceConsoleLogger
- Specified by:
withStandardPrintStream
in interfaceFormattedLogger<java.lang.Object>
- Specified by:
withStandardPrintStream
in interfaceorg.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamBuilder<java.lang.Object>
-
withErrorPrintStream
public ConsoleLoggerSingleton withErrorPrintStream(java.io.PrintStream aErrStream)
- Specified by:
withErrorPrintStream
in interfaceConsoleLogger
- Specified by:
withErrorPrintStream
in interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamBuilder<java.lang.Object>
- Specified by:
withErrorPrintStream
in interfaceFormattedLogger<java.lang.Object>
-
withTableStyle
public ConsoleLoggerSingleton withTableStyle(org.refcodes.textual.TableStyle aTableStyle)
- Specified by:
withTableStyle
in interfaceConsoleLogger
- Specified by:
withTableStyle
in interfaceFormattedLogger<java.lang.Object>
- Specified by:
withTableStyle
in interfaceorg.refcodes.textual.TableStyleAccessor.TableStyleBuilder<java.lang.Object>
-
withEscapeCodes
public ConsoleLoggerSingleton withEscapeCodes(boolean isEscCodesEnabled)
With escape codes.- Specified by:
withEscapeCodes
in interfaceConsoleLogger
- Specified by:
withEscapeCodes
in interfaceFormattedLogger<java.lang.Object>
- Parameters:
isEscCodesEnabled
- the is esc codes enabled- Returns:
- the formatted logger
-
withLeftBorder
public ConsoleLoggerSingleton withLeftBorder(boolean hasLeftBorder)
With left border.- Specified by:
withLeftBorder
in interfaceConsoleLogger
- Specified by:
withLeftBorder
in interfaceFormattedLogger<java.lang.Object>
- Parameters:
hasLeftBorder
- the has left border- Returns:
- the formatted logger
-
withRightBorder
public ConsoleLoggerSingleton withRightBorder(boolean hasRightBorder)
With right border.- Specified by:
withRightBorder
in interfaceConsoleLogger
- Specified by:
withRightBorder
in interfaceFormattedLogger<java.lang.Object>
- Parameters:
hasRightBorder
- the has right border- Returns:
- the formatted logger
-
withRowWidth
public ConsoleLoggerSingleton withRowWidth(int aRowWidth)
- Specified by:
withRowWidth
in interfaceConsoleLogger
- Specified by:
withRowWidth
in interfaceFormattedLogger<java.lang.Object>
- Specified by:
withRowWidth
in interfaceorg.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<java.lang.Object>
-
setLoggerLayout
public void setLoggerLayout(java.lang.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. When configuring programmatically useColumnLayoutAccessor.ColumnLayoutMutator.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:- SUPERUSER
- FALLBACK
- DEVELOPER
- DEVOPS
- END_USER
- Specified by:
setLoggerLayout
in interfaceConsoleLogger
- Parameters:
aLoggerLayout
- the new logger layout
-
hasEscapeCodes
public boolean hasEscapeCodes()
Checks for escape codes.- Specified by:
hasEscapeCodes
in interfaceFormattedLogger<java.lang.Object>
- Returns:
- true, if successful
-
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
-
-