Class 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
    This ConsoleLoggerSingleton provides a ConsoleLoggerImpl 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 this ConsoleLoggerSingleton even when not being able to access the getInstance() method.
    • 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 ConsoleLoggerImpl 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 java.lang.Object> aRecord)
                 throws org.refcodes.logger.IllegalRecordRuntimeException,
                        org.refcodes.logger.UnexpectedLogRuntimeException
        Specified by:
        log in interface org.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 interface org.refcodes.mixin.StandardPrintStreamAccessor
      • setStandardPrintStream

        public void setStandardPrintStream​(java.io.PrintStream aOutStream)
        Specified by:
        setStandardPrintStream in interface org.refcodes.mixin.StandardPrintStreamAccessor.StandardPrintStreamMutator
      • getErrorPrintStream

        public java.io.PrintStream getErrorPrintStream​()
        Specified by:
        getErrorPrintStream in interface org.refcodes.mixin.ErrorPrintStreamAccessor
      • setErrorPrintStream

        public void setErrorPrintStream​(java.io.PrintStream aErrStream)
        Specified by:
        setErrorPrintStream in interface org.refcodes.mixin.ErrorPrintStreamAccessor.ErrorPrintStreamMutator
      • getTableStyle

        public org.refcodes.textual.TableStyle getTableStyle​()
        Specified by:
        getTableStyle in interface org.refcodes.textual.TableStyleAccessor
      • setTableStyle

        public void setTableStyle​(org.refcodes.textual.TableStyle aTableStyle)
        Specified by:
        setTableStyle in interface org.refcodes.textual.TableStyleAccessor.TableStyleMutator
      • setLoggerStyle

        public void setLoggerStyle​(java.lang.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 TableStyleAccessor.TableStyleMutator.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
        • DOUBLE
        • DOUBLE_SINGLE
        • SINGLE_DOUBLE
        • SINGLE_DASHED
        • ASCII
        • BLANK
        • SINGLE_BLANK
        • ASCII_BLANK
        Specified by:
        setLoggerStyle in interface FormattedLogger<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 interface FormattedLogger<java.lang.Object>
        Parameters:
        isEscCodesEnabled - the new escape codes
      • hasLeftBorder

        public boolean hasLeftBorder​()
        Checks for left border.
        Specified by:
        hasLeftBorder in interface FormattedLogger<java.lang.Object>
        Returns:
        true, if successful
      • setLeftBorder

        public void setLeftBorder​(boolean hasLeftBorder)
        Sets the left border.
        Specified by:
        setLeftBorder in interface FormattedLogger<java.lang.Object>
        Parameters:
        hasLeftBorder - the new left border
      • hasRightBorder

        public boolean hasRightBorder​()
        Checks for right border.
        Specified by:
        hasRightBorder in interface FormattedLogger<java.lang.Object>
        Returns:
        true, if successful
      • setRightBorder

        public void setRightBorder​(boolean hasRightBorder)
        Sets the right border.
        Specified by:
        setRightBorder in interface FormattedLogger<java.lang.Object>
        Parameters:
        hasRightBorder - the new right border
      • getRowWidth

        public int getRowWidth​()
        Specified by:
        getRowWidth in interface org.refcodes.mixin.RowWidthAccessor
      • setRowWidth

        public void setRowWidth​(int aRowWidth)
        Specified by:
        setRowWidth in interface org.refcodes.mixin.RowWidthAccessor.RowWidthMutator
      • printSeparator

        public void printSeparator​()
        Specified by:
        printSeparator in interface org.refcodes.logger.Logger<java.lang.Object>
      • setLoggerLayout

        public void setLoggerLayout​(java.lang.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 ColumnLayoutAccessor.ColumnLayoutMutator.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:
        • SUPERUSER
        • FALLBACK
        • DEVELOPER
        • DEVOPS
        • END_USER
        Specified by:
        setLoggerLayout in interface ConsoleLogger
        Parameters:
        aLoggerLayout - the new logger layout
      • hasEscapeCodes

        public boolean hasEscapeCodes​()
        Checks for escape codes.
        Specified by:
        hasEscapeCodes in interface FormattedLogger<java.lang.Object>
        Returns:
        true, if successful
      • getColumnLayout

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

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