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

      • 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
      • 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
      • setLeftBorder

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

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

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

        public void printTail()
        Specified by:
        printTail in interface org.refcodes.logger.LogDecorator
        Overrides:
        printTail 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
      • 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
      • 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