Class ConsoleLogger

  • 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
    Direct Known Subclasses:
    ConsoleLoggerSingleton

    public class ConsoleLogger
    extends AbstractConsoleLogger<Object>
    implements org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutProperty, org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutBuilder<ConsoleLogger>
    Specialized subclass of the AbstractConsoleLogger for handling RuntimeLogger's logs with ANSI Escape-Codes.
    • Field Detail

      • _errorBuilder

        protected org.refcodes.textual.TableBuilder _errorBuilder
      • _standardBuilder

        protected org.refcodes.textual.TableBuilder _standardBuilder
      • _standardHeader

        protected org.refcodes.tabular.FormattedHeader<Object> _standardHeader
    • Constructor Detail

      • ConsoleLogger

        public ConsoleLogger()
        Instantiates a new console logger impl.
      • ConsoleLogger

        public ConsoleLogger​(org.refcodes.logger.ColumnLayout aLoggerLayout)
        Instantiates a new console logger impl.
        Parameters:
        aLoggerLayout - the logger layout
    • Method Detail

      • 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
      • 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 AbstractConsoleLogger<Object>
        Throws:
        org.refcodes.logger.IllegalRecordRuntimeException
        org.refcodes.logger.UnexpectedLogRuntimeException
      • withColumnLayout

        public ConsoleLogger withColumnLayout​(org.refcodes.logger.ColumnLayout aColumnLayout)
        Specified by:
        withColumnLayout in interface org.refcodes.logger.ColumnLayoutAccessor.ColumnLayoutBuilder<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 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
        Parameters:
        aLoggerLayout - the new logger layout
      • setLayout

        public void setLayout​(String aLoggerLayout)
        Convenience method for 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 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
        Parameters:
        aLoggerLayout - the new logger layout
      • toLoggerLayout

        protected static org.refcodes.logger.ColumnLayout toLoggerLayout​(org.refcodes.logger.ColumnLayout aLoggerLayout)
        Determines the ColumnLayout by evaluating the SystemProperty.LOGGER_LAYOUT and the EnvironmentVariable.LOGGER_LAYOUT (in this order). If none (valid) layout was determinable, then the ColumnLayout.SUPERUSER is returned.
        Parameters:
        aLoggerLayout - the logger layout
        Returns:
        The ColumnLayout to be used.
      • toLoggerLayout

        protected static org.refcodes.logger.ColumnLayout toLoggerLayout()
        To logger layout.
        Returns:
        the column layout
      • toShortcutLoggerStyle

        protected static org.refcodes.textual.TableStyle toShortcutLoggerStyle()
        Determines the TableStyle by evaluating the SystemProperty.LOGGER_STYLE and the EnvironmentVariable.LOGGER_STYLE (in this order). If none (valid) style was determinable, then a proposed style is returned.
        Returns:
        The TableStyle to be used.
      • printException

        protected void printException​(Throwable theException)
        Prints the exception.
        Parameters:
        theException - the the exception