Class 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

public class ConsoleLoggerSingleton extends ConsoleLogger
This ConsoleLoggerSingleton provides a ConsoleLogger singleton .
  • 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 this ConsoleLoggerSingleton even when not being able to access the getInstance() method. The instance overhead for providing singleton behavior is taken into account.
  • Method Details

    • getInstance

      public static ConsoleLogger getInstance() throws org.refcodes.logger.LoggerInstantiationRuntimeException
      Returns the singleton's instance as fabricated by this ConsoleLoggerSingleton.
      Returns:
      The RuntimeLogger singleton's instance.
      Throws:
      org.refcodes.logger.LoggerInstantiationRuntimeException - Thrown in case instantiating a Logger (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 interface org.refcodes.logger.Logger<Object>
      Overrides:
      log in class ConsoleLogger
      Throws:
      org.refcodes.logger.IllegalRecordRuntimeException
      org.refcodes.logger.UnexpectedLogRuntimeException
    • getStandardPrintStream

      public PrintStream getStandardPrintStream()
      Specified by:
      getStandardPrintStream in interface org.refcodes.mixin.StandardPrintStreamAccessor
      Overrides:
      getStandardPrintStream in class AbstractConsoleLogger<Object>
    • setStandardPrintStream

      public void setStandardPrintStream(PrintStream aOutStream)
      Specified by:
      setStandardPrintStream in interface org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamMutator
      Overrides:
      setStandardPrintStream in class AbstractConsoleLogger<Object>
    • getErrorPrintStream

      public PrintStream getErrorPrintStream()
      Specified by:
      getErrorPrintStream in interface org.refcodes.mixin.ErrorPrintStreamAccessor
      Overrides:
      getErrorPrintStream in class AbstractConsoleLogger<Object>
    • setErrorPrintStream

      public void setErrorPrintStream(PrintStream aErrStream)
      Specified by:
      setErrorPrintStream in interface org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator
      Overrides:
      setErrorPrintStream in class AbstractConsoleLogger<Object>
    • getTableStyle

      public org.refcodes.textual.TableStyle getTableStyle()
      Specified by:
      getTableStyle in interface org.refcodes.textual.TableStyleAccessor
      Overrides:
      getTableStyle in class AbstractConsoleLogger<Object>
    • setTableStyle

      public void setTableStyle(org.refcodes.textual.TableStyle aTableStyle)
      Specified by:
      setTableStyle in interface org.refcodes.textual.TableStyleAccessor.TableStyleMutator
      Overrides:
      setTableStyle in class AbstractConsoleLogger<Object>
    • setLoggerStyle

      public void setLoggerStyle(String aTableStyleName)
      As the underlying configuration framework used by the RuntimeLoggerSingleton cannot convert a String to an enum, we got to provide such a method ourselves. When configuring programmatically use AbstractConsoleLogger.setTableStyle(TableStyle), when using the "runtimelogger-config.xml" use the property "loggerStyle" for this method to be invoked. Valid arguments are as of the TableStyle 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 class AbstractConsoleLogger<Object>
      Parameters:
      aTableStyleName - The style to use for the logger.
    • setEscapeCodes

      public void setEscapeCodes(boolean isEscCodesEnabled)
      Sets the escape codes.
      Overrides:
      setEscapeCodes in class AbstractConsoleLogger<Object>
      Parameters:
      isEscCodesEnabled - the new escape codes
    • hasLeftBorder

      public boolean hasLeftBorder()
      Checks for left border.
      Overrides:
      hasLeftBorder in class AbstractConsoleLogger<Object>
      Returns:
      true, if successful
    • setLeftBorder

      public void setLeftBorder(boolean hasLeftBorder)
      Sets the left border.
      Overrides:
      setLeftBorder in class AbstractConsoleLogger<Object>
      Parameters:
      hasLeftBorder - the new left border
    • hasRightBorder

      public boolean hasRightBorder()
      Checks for right border.
      Overrides:
      hasRightBorder in class AbstractConsoleLogger<Object>
      Returns:
      true, if successful
    • setRightBorder

      public void setRightBorder(boolean hasRightBorder)
      Sets the right border.
      Overrides:
      setRightBorder in class AbstractConsoleLogger<Object>
      Parameters:
      hasRightBorder - the new right border
    • getRowWidth

      public int getRowWidth()
      Specified by:
      getRowWidth in interface org.refcodes.mixin.RowWidthAccessor
      Overrides:
      getRowWidth in class AbstractConsoleLogger<Object>
    • setRowWidth

      public void setRowWidth(int aRowWidth)
      Specified by:
      setRowWidth in interface org.refcodes.mixin.RowWidthAccessor.RowWidthMutator
      Overrides:
      setRowWidth in class AbstractConsoleLogger<Object>
    • printHead

      public void printHead()
      Specified by:
      printHead in interface org.refcodes.logger.LogDecorator
      Overrides:
      printHead in class AbstractConsoleLogger<Object>
    • printSeparator

      public void printSeparator()
      Specified by:
      printSeparator in interface org.refcodes.logger.LogDecorator
      Overrides:
      printSeparator in class AbstractConsoleLogger<Object>
    • printTail

      public void printTail()
      Specified by:
      printTail in interface org.refcodes.logger.LogDecorator
      Overrides:
      printTail in class ConsoleLogger
    • withStandardPrintStream

      public ConsoleLoggerSingleton withStandardPrintStream(PrintStream aOutStream)
      Specified by:
      withStandardPrintStream in interface org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamBuilder<AbstractConsoleLogger<Object>>
      Overrides:
      withStandardPrintStream in class ConsoleLogger
    • withErrorPrintStream

      public ConsoleLoggerSingleton withErrorPrintStream(PrintStream aErrStream)
      Specified by:
      withErrorPrintStream in interface org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamBuilder<AbstractConsoleLogger<Object>>
      Overrides:
      withErrorPrintStream in class ConsoleLogger
    • withTableStyle

      public ConsoleLoggerSingleton withTableStyle(org.refcodes.textual.TableStyle aTableStyle)
      Specified by:
      withTableStyle in interface org.refcodes.textual.TableStyleAccessor.TableStyleBuilder<AbstractConsoleLogger<?>>
      Overrides:
      withTableStyle in class ConsoleLogger
    • withEscapeCodes

      public ConsoleLoggerSingleton withEscapeCodes(boolean isEscCodesEnabled)
      With escape codes.
      Overrides:
      withEscapeCodes in class ConsoleLogger
      Parameters:
      isEscCodesEnabled - the is esc codes enabled
      Returns:
      the formatted logger
    • withLeftBorder

      public ConsoleLoggerSingleton withLeftBorder(boolean hasLeftBorder)
      With left border.
      Overrides:
      withLeftBorder in class ConsoleLogger
      Parameters:
      hasLeftBorder - the has left border
      Returns:
      the formatted logger
    • withRightBorder

      public ConsoleLoggerSingleton withRightBorder(boolean hasRightBorder)
      With right border.
      Overrides:
      withRightBorder in class ConsoleLogger
      Parameters:
      hasRightBorder - the has right border
      Returns:
      the formatted logger
    • withRowWidth

      public ConsoleLoggerSingleton withRowWidth(int aRowWidth)
      Specified by:
      withRowWidth in interface org.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<AbstractConsoleLogger<?>>
      Overrides:
      withRowWidth in class ConsoleLogger
    • setLoggerLayout

      public void setLoggerLayout(String aLoggerLayout)
      As the underlying configuration framework used by the RuntimeLoggerSingleton cannot convert a String to an enum, we got to provide such a method ourselves. When configuring programmatically use ConsoleLogger.setColumnLayout(ColumnLayout), when using the "runtimelogger-config.xml" use the property "loggerLayout" for this method to be invoked. Valid arguments are as of the ColumnLayout enumeration:
      • GRANDPA
      • SUPERUSER
      • FALLBACK
      • DEVELOPER
      • DEVOPS
      • ENDUSER
      • ANALYST
      Overrides:
      setLoggerLayout in class ConsoleLogger
      Parameters:
      aLoggerLayout - the new logger layout
    • setLayout

      public void setLayout(String aLoggerLayout)
      Convenience method for ConsoleLogger.setLoggerLayout(String): As the underlying configuration framework used by the RuntimeLoggerSingleton cannot convert a String to an enum, we got to provide such a method ourselves. When configuring programmatically use ConsoleLogger.setColumnLayout(ColumnLayout), when using the "runtimelogger-config.xml" use the property "loggerLayout" for this method to be invoked. Valid arguments are as of the ColumnLayout enumeration:
      • GRANDPA
      • SUPERUSER
      • FALLBACK
      • DEVELOPER
      • DEVOPS
      • ENDUSER
      • ANALYST
      Overrides:
      setLayout in class ConsoleLogger
      Parameters:
      aLoggerLayout - the new logger layout
    • hasEscapeCodes

      public boolean hasEscapeCodes()
      Checks for escape codes.
      Overrides:
      hasEscapeCodes in class AbstractConsoleLogger<Object>
      Returns:
      true, if successful
    • getColumnLayout

      public org.refcodes.logger.ColumnLayout getColumnLayout()
      Specified by:
      getColumnLayout in interface org.refcodes.logger.ColumnLayoutAccessor
      Overrides:
      getColumnLayout in class ConsoleLogger
    • setColumnLayout

      public void setColumnLayout(org.refcodes.logger.ColumnLayout aColumnLayout)
      Specified by:
      setColumnLayout in interface org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutMutator
      Overrides:
      setColumnLayout in class ConsoleLogger