Class LogFormatter


  • public final class LogFormatter
    extends java.util.logging.Formatter
    This Formatter is used by the EASyLogger to format the logging output.
    Author:
    Sass
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.text.SimpleDateFormat DATE_FORMAT  
      private static java.lang.String LINE_SEPARATOR  
    • Constructor Summary

      Constructors 
      Constructor Description
      LogFormatter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void appendEclipseDebugLink​(java.util.logging.LogRecord record, java.lang.StringBuilder sb)
      Appends a clickable link for the Eclipse IDE, which points to the file and line number where the Message was created.
      java.lang.String format​(java.util.logging.LogRecord record)  
      private java.lang.StackTraceElement getCallerStackFrame​(java.lang.String callerName)
      Gets the CallerStackFrame for the Class throwing the exception.
      • Methods inherited from class java.util.logging.Formatter

        formatMessage, getHead, getTail
      • Methods inherited from class java.lang.Object

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

      • LINE_SEPARATOR

        private static final java.lang.String LINE_SEPARATOR
      • DATE_FORMAT

        private static final java.text.SimpleDateFormat DATE_FORMAT
    • Constructor Detail

      • LogFormatter

        public LogFormatter()
    • Method Detail

      • format

        public java.lang.String format​(java.util.logging.LogRecord record)
        Specified by:
        format in class java.util.logging.Formatter
      • appendEclipseDebugLink

        private void appendEclipseDebugLink​(java.util.logging.LogRecord record,
                                            java.lang.StringBuilder sb)
        Appends a clickable link for the Eclipse IDE, which points to the file and line number where the Message was created. Note:
        • Only useful when Code was compiled with debug information
        • Only useful when EASy is executed inside Eclipse
        Parameters:
        record - the log record to be formatted.
        sb - the formatted log record (which is currently build.
      • getCallerStackFrame

        private java.lang.StackTraceElement getCallerStackFrame​(java.lang.String callerName)
        Gets the CallerStackFrame for the Class throwing the exception.
        Parameters:
        callerName - Name of the class
        Returns:
        StackTraceElement of callerName