public static class IP2LocationEventLog.LogEntry extends Object
Log entries are immutable and contain all information about a single event, including timestamp, severity, category, message, and optional detail (such as a stack trace for errors).
| Constructor and Description |
|---|
LogEntry(Instant timestamp,
IP2LocationEventLog.EventType type,
IP2LocationEventLog.EventCategory category,
String message,
String detail)
Creates a log entry.
|
| Modifier and Type | Method and Description |
|---|---|
static IP2LocationEventLog.LogEntry |
fromJson(String json)
Parses a log entry from a JSON string.
|
IP2LocationEventLog.EventCategory |
getCategory()
Returns the category/classification of this event.
|
String |
getDetail()
Returns optional detail text such as a stack trace.
|
String |
getFormattedTimestamp()
Returns a formatted timestamp string for display.
|
String |
getMessage()
Returns the human-readable message describing this event.
|
String |
getSummary()
Returns a single-line summary suitable for display in lists.
|
Instant |
getTimestamp()
Returns the timestamp when this event occurred.
|
IP2LocationEventLog.EventType |
getType()
Returns the severity level of this event.
|
String |
toJson()
Converts this entry to a JSON string for file persistence.
|
public LogEntry(Instant timestamp, IP2LocationEventLog.EventType type, IP2LocationEventLog.EventCategory category, String message, String detail)
timestamp - The time when this event occurredtype - The severity levelcategory - The event categorymessage - The event messagedetail - Optional detail text (may be null)public Instant getTimestamp()
public IP2LocationEventLog.EventType getType()
public IP2LocationEventLog.EventCategory getCategory()
public String getMessage()
public String getDetail()
null if nonepublic String getFormattedTimestamp()
Format: "yyyy-MM-dd HH:mm:ss" in the system's default timezone.
public String getSummary()
Format: "[timestamp] TYPE: message"
public String toJson()
The JSON format is a single line with no pretty-printing, suitable for JSON-lines file format.
public static IP2LocationEventLog.LogEntry fromJson(String json)
This is the inverse of toJson(). If the JSON is malformed
or missing required fields, returns null.
json - The JSON string to parsenull if parsing failedPhantom® and NetPhantom® are registered trademarks of Mindus SARL.
© 2026 Mindus SARL. All rights reserved.