Package com.guicedee.logger.model
Class LogEntry
java.lang.Object
com.guicedee.logger.model.LogEntry
public class LogEntry
extends java.lang.Object
A default Log Entry
- Since:
- Nov 22, 2016
- Author:
- GedMarc
-
Method Summary
Modifier and Type Method Description java.lang.ObjectgetData()Any attached object that you would want the data fromjava.util.DategetDate()Returns the date of this log entryjava.text.SimpleDateFormatgetDateFormatter()Returns the current formatter for the datestatic java.util.Map<LogProperties,java.lang.Boolean>getDisplayedProperties()Configuration for the log properties that are displayedstatic java.util.List<java.lang.String>getExceptionHighlightedPackages()Exception packages that get highlightedjava.util.logging.LevelgetLevel()Gets the level of this log entryjava.lang.StringgetMessage()Returns the message for this log entry@NotNull java.lang.StringgetOriginalSourceSystemID()The original source system id@NotNull java.util.List<LogProperty>getProperties()* Returns the properties of this log entryjava.util.Map<java.lang.String,java.lang.String>getPropertiesFromMessage(java.lang.String message)Returns the properties map form this log entryLogPropertygetProperty(java.lang.String name)Returns a specific log propertystatic java.util.regex.PatterngetPropertyPattern()Returns the actual patternstatic LogEntrynewEntry()Creates a new log entry with all global properties attachedstatic LogEntrynewEntry(java.util.logging.LogRecord record)Creates a new log entry with all global properties attachedstatic java.lang.StringpadLeft(java.lang.String s, int n)Pads the property field or value by the numberstatic java.lang.StringpadRight(java.lang.String s, int n)Pads a property field or value by so many digitsLogEntrysetData(java.lang.Object data)Any attached object you would want to fetch data fromLogEntrysetDate(java.util.Date date)Sets the date of this log entryLogEntrysetLevel(java.util.logging.Level level)Sets the level of this log entryLogEntrysetMessage(java.lang.String message)Returns the message for this entryLogEntrysetOriginalSourceSystemID(java.lang.String originalSourceSystemID)The original source system id@NotNull LogEntrysetProperties(@NotNull java.util.List<LogProperty> properties)Sets the properties of this log entryjava.lang.StringtoString()Returns the log entry with the square bracketsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Method Details
-
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
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
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 stringn- 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 stringn- 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
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:
toStringin classjava.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
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
Any attached object you would want to fetch data from- Parameters:
data- Any data with this entry- Returns:
- This entry
-
setDate
Sets the date of this log entry- Parameters:
date- The date of this entry- Returns:
- The log entry
-
setMessage
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
The original source system id- Parameters:
originalSourceSystemID- The original source system- Returns:
- this;
-
getProperty
Returns a specific log property- Parameters:
name- The name of the property- Returns:
- The log property of the item
-