Class AbstractOutputTarget

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Formatter m_formatter
      Formatter for target.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Shutdown target.
      protected void doProcessEvent​(LogEvent event)
      Process a log event.
      private java.lang.String format​(LogEvent event)
      Helper method to format an event into a string, using the formatter if available.
      protected Formatter getFormatter()
      Returns the Formatter.
      private java.lang.String getHead()
      Helper method to retrieve head for log session.
      private java.lang.String getTail()
      Helper method to retrieve tail for log session.
      protected void open()
      Startup log session.
      protected void write​(java.lang.String data)
      Abstract method to write data.
      private void writeHead()
      Helper method to write out log head.
      private void writeTail()
      Helper method to write out log tail.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • m_formatter

        private Formatter m_formatter
        Formatter for target.
    • Constructor Detail

      • AbstractOutputTarget

        public AbstractOutputTarget()
        Parameterless constructor.
      • AbstractOutputTarget

        public AbstractOutputTarget​(Formatter formatter)
        Creation of a new abstract output target instance.
        Parameters:
        formatter - the formatter to apply
    • Method Detail

      • getFormatter

        protected Formatter getFormatter()
        Returns the Formatter.
      • write

        protected void write​(java.lang.String data)
        Abstract method to write data.
        Parameters:
        data - the data to be output
      • doProcessEvent

        protected void doProcessEvent​(LogEvent event)
        Process a log event.
        Specified by:
        doProcessEvent in class AbstractTarget
        Parameters:
        event - the event to process
      • open

        protected void open()
        Startup log session.
        Overrides:
        open in class AbstractTarget
      • close

        public void close()
        Shutdown target. Attempting to write to target after close() will cause errors to be logged.
        Specified by:
        close in interface Closeable
        Overrides:
        close in class AbstractTarget
      • format

        private java.lang.String format​(LogEvent event)
        Helper method to format an event into a string, using the formatter if available.
        Parameters:
        event - the LogEvent
        Returns:
        the formatted string
      • writeHead

        private void writeHead()
        Helper method to write out log head. The head initiates a session of logging.
      • writeTail

        private void writeTail()
        Helper method to write out log tail. The tail completes a session of logging.
      • getHead

        private java.lang.String getHead()
        Helper method to retrieve head for log session. TODO: Extract from formatter
        Returns:
        the head string
      • getTail

        private java.lang.String getTail()
        Helper method to retrieve tail for log session. TODO: Extract from formatter
        Returns:
        the head string