Class LogEntry


  • public class LogEntry
    extends java.lang.Object
    A default Log Entry
    Since:
    Nov 22, 2016
    Author:
    GedMarc
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getData()
      Any attached object that you would want the data from
      java.util.Date getDate()
      Returns the date of this log entry
      java.text.SimpleDateFormat getDateFormatter()
      Returns the current formatter for the date
      static java.util.Map<LogProperties,​java.lang.Boolean> getDisplayedProperties()
      Configuration for the log properties that are displayed
      static java.util.List<java.lang.String> getExceptionHighlightedPackages()
      Exception packages that get highlighted
      java.util.logging.Level getLevel()
      Gets the level of this log entry
      java.lang.String getMessage()
      Returns the message for this log entry
      @NotNull java.lang.String getOriginalSourceSystemID()
      The original source system id
      @NotNull java.util.List<LogProperty> getProperties()
      * Returns the properties of this log entry
      java.util.Map<java.lang.String,​java.lang.String> getPropertiesFromMessage​(java.lang.String message)
      Returns the properties map form this log entry
      LogProperty getProperty​(java.lang.String name)
      Returns a specific log property
      static java.util.regex.Pattern getPropertyPattern()
      Returns the actual pattern
      static LogEntry newEntry()
      Creates a new log entry with all global properties attached
      static LogEntry newEntry​(java.util.logging.LogRecord record)
      Creates a new log entry with all global properties attached
      static java.lang.String padLeft​(java.lang.String s, int n)
      Pads the property field or value by the number
      static java.lang.String padRight​(java.lang.String s, int n)
      Pads a property field or value by so many digits
      LogEntry setData​(java.lang.Object data)
      Any attached object you would want to fetch data from
      LogEntry setDate​(java.util.Date date)
      Sets the date of this log entry
      LogEntry setLevel​(java.util.logging.Level level)
      Sets the level of this log entry
      LogEntry setMessage​(java.lang.String message)
      Returns the message for this entry
      LogEntry setOriginalSourceSystemID​(java.lang.String originalSourceSystemID)
      The original source system id
      @NotNull LogEntry setProperties​(@NotNull java.util.List<LogProperty> properties)
      Sets the properties of this log entry
      java.lang.String toString()
      Returns the log entry with the square brackets
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getProperties

        @NotNull
        public @NotNull java.util.List<LogProperty> getProperties()
        * Returns the properties of this log entry
        Returns:
        A list of Log Properties
      • setProperties

        @NotNull
        public @NotNull LogEntry setProperties​(@NotNull
                                               @NotNull java.util.List<LogProperty> properties)
        Sets the properties of this log entry
        Parameters:
        properties - A list of properties to set for this list
        Returns:
        LogEntry
      • newEntry

        public static LogEntry newEntry​(java.util.logging.LogRecord record)
        Creates a new log entry with all global properties attached
        Parameters:
        record - A log record produced by java logging
        Returns:
        A more object based log entry constructed from the log record
      • newEntry

        public static LogEntry newEntry()
        Creates a new log entry with all global properties attached
        Returns:
        A new entry
      • padRight

        public static java.lang.String padRight​(java.lang.String s,
                                                int n)
        Pads a property field or value by so many digits
        Parameters:
        s - the string
        n - number of digits
        Returns:
        The padded string right
      • getPropertiesFromMessage

        public java.util.Map<java.lang.String,​java.lang.String> getPropertiesFromMessage​(java.lang.String message)
        Returns the properties map form this log entry
        Parameters:
        message - The message to break into key property pairs
        Returns:
        The rendered maps
      • padLeft

        public static java.lang.String padLeft​(java.lang.String s,
                                               int n)
        Pads the property field or value by the number
        Parameters:
        s - the string
        n - the number of chars to
        Returns:
        The string padded left
      • getPropertyPattern

        public static java.util.regex.Pattern getPropertyPattern()
        Returns the actual pattern
        Returns:
        The property list
      • getDisplayedProperties

        public static java.util.Map<LogProperties,​java.lang.Boolean> getDisplayedProperties()
        Configuration for the log properties that are displayed
        Returns:
        The list of properties to render from the filter list
      • getExceptionHighlightedPackages

        public static java.util.List<java.lang.String> getExceptionHighlightedPackages()
        Exception packages that get highlighted
        Returns:
        The list of packages to highlight output on
      • getDateFormatter

        public java.text.SimpleDateFormat getDateFormatter()
        Returns the current formatter for the date
        Returns:
        An instance of the date formatter
      • toString

        public java.lang.String toString()
        Returns the log entry with the square brackets
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation in brackets of the log message
      • getMessage

        public java.lang.String getMessage()
        Returns the message for this log entry
        Returns:
        the Message
      • getLevel

        public java.util.logging.Level getLevel()
        Gets the level of this log entry
        Returns:
        The level applied
      • setLevel

        public LogEntry setLevel​(java.util.logging.Level level)
        Sets the level of this log entry
        Parameters:
        level - The level
        Returns:
        This object
      • getDate

        public java.util.Date getDate()
        Returns the date of this log entry
        Returns:
        The date associated with this entry
      • getData

        public java.lang.Object getData()
        Any attached object that you would want the data from
        Returns:
        Any data associated with this entry - customized
      • setData

        public LogEntry setData​(java.lang.Object data)
        Any attached object you would want to fetch data from
        Parameters:
        data - Any data with this entry
        Returns:
        This entry
      • setDate

        public LogEntry setDate​(java.util.Date date)
        Sets the date of this log entry
        Parameters:
        date - The date of this entry
        Returns:
        The log entry
      • setMessage

        public LogEntry setMessage​(java.lang.String message)
        Returns the message for this entry
        Parameters:
        message - Sets the message unmapped into a log entry from bracket form
        Returns:
        This log entry with mapped properties
      • getOriginalSourceSystemID

        @NotNull
        public @NotNull java.lang.String getOriginalSourceSystemID()
        The original source system id
        Returns:
        an empty string
      • setOriginalSourceSystemID

        public LogEntry setOriginalSourceSystemID​(java.lang.String originalSourceSystemID)
        The original source system id
        Parameters:
        originalSourceSystemID - The original source system
        Returns:
        this;
      • getProperty

        public LogProperty getProperty​(java.lang.String name)
        Returns a specific log property
        Parameters:
        name - The name of the property
        Returns:
        The log property of the item