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.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
Fields inherited from class org.refcodes.logger.alt.console.ConsoleLogger
_errorBuilder, _standardBuilder, _standardHeaderFields 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
ConstructorsConstructorDescriptionConstructor for constructing a pseudo singleton; this constructor is public to provide means to some configuration frameworks (such as commons-configurations from Apache) for using thisConsoleLoggerSingletoneven when not being able to access thegetInstance()method. -
Method Summary
Modifier and TypeMethodDescriptionorg.refcodes.logger.ColumnLayoutstatic ConsoleLoggerReturns the singleton's instance as fabricated by thisConsoleLoggerSingleton.intorg.refcodes.textual.TableStylebooleanChecks for escape codes.booleanChecks for left border.booleanChecks for right border.voidvoidvoidvoidvoidsetColumnLayout(org.refcodes.logger.ColumnLayout aColumnLayout) voidsetErrorPrintStream(PrintStream aErrStream) voidsetEscapeCodes(boolean isEscCodesEnabled) Sets the escape codes.voidConvenience method forConsoleLogger.setLoggerLayout(String): As the underlying configuration framework used by theRuntimeLoggerSingletoncannot convert a String to an enum, we got to provide such a method ourselves.voidsetLeftBorder(boolean hasLeftBorder) Sets the left border.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.voidsetLoggerStyle(String aTableStyleName) As the underlying configuration framework used by theRuntimeLoggerSingletoncannot convert a String to an enum, we got to provide such a method ourselves.voidsetRightBorder(boolean hasRightBorder) Sets the right border.voidsetRowWidth(int aRowWidth) voidsetStandardPrintStream(PrintStream aOutStream) voidsetTableStyle(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, withColumnLayoutMethods inherited from class org.refcodes.logger.alt.console.AbstractConsoleLogger
destroy, log, setStyle, 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
-
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 thisConsoleLoggerSingletoneven when not being able to access thegetInstance()method. The instance overhead for providing singleton behavior is taken into account.
-
-
Method Details
-
getInstance
Returns the singleton's instance as fabricated by thisConsoleLoggerSingleton.- Returns:
- The
RuntimeLoggersingleton's instance. - Throws:
org.refcodes.logger.LoggerInstantiationRuntimeException- Thrown in case instantiating aLogger(RuntimeLogger) failed
-
log
- Specified by:
login interfaceorg.refcodes.logger.Logger<Object>- Overrides:
login classConsoleLogger
-
getStandardPrintStream
- Specified by:
getStandardPrintStreamin interfaceorg.refcodes.mixin.StandardPrintStreamAccessor- Overrides:
getStandardPrintStreamin classAbstractConsoleLogger<Object>
-
setStandardPrintStream
- Specified by:
setStandardPrintStreamin interfaceorg.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamMutator- Overrides:
setStandardPrintStreamin classAbstractConsoleLogger<Object>
-
getErrorPrintStream
- Specified by:
getErrorPrintStreamin interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor- Overrides:
getErrorPrintStreamin classAbstractConsoleLogger<Object>
-
setErrorPrintStream
- Specified by:
setErrorPrintStreamin interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator- Overrides:
setErrorPrintStreamin classAbstractConsoleLogger<Object>
-
getTableStyle
public org.refcodes.textual.TableStyle getTableStyle()- Specified by:
getTableStylein interfaceorg.refcodes.textual.TableStyleAccessor- Overrides:
getTableStylein classAbstractConsoleLogger<Object>
-
setTableStyle
public void setTableStyle(org.refcodes.textual.TableStyle aTableStyle) - Specified by:
setTableStylein interfaceorg.refcodes.textual.TableStyleAccessor.TableStyleMutator- Overrides:
setTableStylein classAbstractConsoleLogger<Object>
-
setLoggerStyle
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 useAbstractConsoleLogger.setTableStyle(TableStyle), when using the "runtimelogger-config.xml" use the property "loggerStyle" for this method to be invoked. Valid arguments are as of theTableStyleenumeration:- 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:
setLoggerStylein classAbstractConsoleLogger<Object>- Parameters:
aTableStyleName- The style to use for the logger.
-
setEscapeCodes
public void setEscapeCodes(boolean isEscCodesEnabled) Sets the escape codes.- Overrides:
setEscapeCodesin classAbstractConsoleLogger<Object>- Parameters:
isEscCodesEnabled- the new escape codes
-
hasLeftBorder
public boolean hasLeftBorder()Checks for left border.- Overrides:
hasLeftBorderin classAbstractConsoleLogger<Object>- Returns:
- true, if successful
-
setLeftBorder
public void setLeftBorder(boolean hasLeftBorder) Sets the left border.- Overrides:
setLeftBorderin classAbstractConsoleLogger<Object>- Parameters:
hasLeftBorder- the new left border
-
hasRightBorder
public boolean hasRightBorder()Checks for right border.- Overrides:
hasRightBorderin classAbstractConsoleLogger<Object>- Returns:
- true, if successful
-
setRightBorder
public void setRightBorder(boolean hasRightBorder) Sets the right border.- Overrides:
setRightBorderin classAbstractConsoleLogger<Object>- Parameters:
hasRightBorder- the new right border
-
getRowWidth
public int getRowWidth()- Specified by:
getRowWidthin interfaceorg.refcodes.mixin.RowWidthAccessor- Overrides:
getRowWidthin classAbstractConsoleLogger<Object>
-
setRowWidth
public void setRowWidth(int aRowWidth) - Specified by:
setRowWidthin interfaceorg.refcodes.mixin.RowWidthAccessor.RowWidthMutator- Overrides:
setRowWidthin classAbstractConsoleLogger<Object>
-
printHead
public void printHead()- Specified by:
printHeadin interfaceorg.refcodes.logger.LogDecorator- Overrides:
printHeadin classAbstractConsoleLogger<Object>
-
printSeparator
public void printSeparator()- Specified by:
printSeparatorin interfaceorg.refcodes.logger.LogDecorator- Overrides:
printSeparatorin classAbstractConsoleLogger<Object>
-
printTail
public void printTail()- Specified by:
printTailin interfaceorg.refcodes.logger.LogDecorator- Overrides:
printTailin classConsoleLogger
-
withStandardPrintStream
- Specified by:
withStandardPrintStreamin interfaceorg.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamBuilder<AbstractConsoleLogger<Object>>- Overrides:
withStandardPrintStreamin classConsoleLogger
-
withErrorPrintStream
- Specified by:
withErrorPrintStreamin interfaceorg.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamBuilder<AbstractConsoleLogger<Object>>- Overrides:
withErrorPrintStreamin classConsoleLogger
-
withTableStyle
- Specified by:
withTableStylein interfaceorg.refcodes.textual.TableStyleAccessor.TableStyleBuilder<AbstractConsoleLogger<?>>- Overrides:
withTableStylein classConsoleLogger
-
withEscapeCodes
With escape codes.- Overrides:
withEscapeCodesin classConsoleLogger- Parameters:
isEscCodesEnabled- the is esc codes enabled- Returns:
- the formatted logger
-
withLeftBorder
With left border.- Overrides:
withLeftBorderin classConsoleLogger- Parameters:
hasLeftBorder- the has left border- Returns:
- the formatted logger
-
withRightBorder
With right border.- Overrides:
withRightBorderin classConsoleLogger- Parameters:
hasRightBorder- the has right border- Returns:
- the formatted logger
-
withRowWidth
- Specified by:
withRowWidthin interfaceorg.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<AbstractConsoleLogger<?>>- Overrides:
withRowWidthin classConsoleLogger
-
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 useConsoleLogger.setColumnLayout(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
- Overrides:
setLoggerLayoutin classConsoleLogger- Parameters:
aLoggerLayout- the new logger layout
-
setLayout
Convenience method forConsoleLogger.setLoggerLayout(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 useConsoleLogger.setColumnLayout(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
- Overrides:
setLayoutin classConsoleLogger- Parameters:
aLoggerLayout- the new logger layout
-
hasEscapeCodes
public boolean hasEscapeCodes()Checks for escape codes.- Overrides:
hasEscapeCodesin classAbstractConsoleLogger<Object>- Returns:
- true, if successful
-
getColumnLayout
public org.refcodes.logger.ColumnLayout getColumnLayout()- Specified by:
getColumnLayoutin interfaceorg.refcodes.logger.ColumnLayoutAccessor- Overrides:
getColumnLayoutin classConsoleLogger
-
setColumnLayout
public void setColumnLayout(org.refcodes.logger.ColumnLayout aColumnLayout) - Specified by:
setColumnLayoutin interfaceorg.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutMutator- Overrides:
setColumnLayoutin classConsoleLogger
-