Package net.i2p.router.util
Class EventLog
java.lang.Object
net.i2p.router.util.EventLog
public class EventLog extends Object
Simple event logger for occasional events,
with caching for reads.
Does not keep the file open.
- Since:
- 0.9.3
-
Field Summary
Fields Modifier and Type Field Description static String
ABORTED
for convenience, not requiredstatic String
BECAME_FLOODFILL
static String
CHANGE_IP
static String
CHANGE_PORT
static String
CLOCK_SHIFT
static String
CRASHED
static String
CRITICAL
static String
INSTALL_FAILED
static String
INSTALLED
static String
NETWORK
static String
NEW_IDENT
static String
NOT_FLOODFILL
static String
OOM
static String
REACHABILITY
static String
REKEYED
static String
RESEED
static String
SOFT_RESTART
static String
STARTED
static String
STOPPED
static String
UPDATED
static String
WATCHDOG
-
Constructor Summary
Constructors Constructor Description EventLog(I2PAppContext ctx, File file)
-
Method Summary
Modifier and Type Method Description void
addEvent(String event)
Append an event.void
addEvent(String event, String info)
Append an event.SortedMap<Long,String>
getEvents(long since)
All events since a given time.SortedMap<Long,String>
getEvents(String event, long since)
Caches.long
getLastEvent(String event, long since)
Timestamp of last event.
-
Field Details
-
ABORTED
for convenience, not required- See Also:
- Constant Field Values
-
BECAME_FLOODFILL
- See Also:
- Constant Field Values
-
CHANGE_IP
- See Also:
- Constant Field Values
-
CHANGE_PORT
- See Also:
- Constant Field Values
-
CLOCK_SHIFT
- See Also:
- Constant Field Values
-
CRASHED
- See Also:
- Constant Field Values
-
CRITICAL
- See Also:
- Constant Field Values
-
INSTALLED
- See Also:
- Constant Field Values
-
INSTALL_FAILED
- See Also:
- Constant Field Values
-
NETWORK
- See Also:
- Constant Field Values
-
NEW_IDENT
- See Also:
- Constant Field Values
-
NOT_FLOODFILL
- See Also:
- Constant Field Values
-
OOM
- See Also:
- Constant Field Values
-
REACHABILITY
- See Also:
- Constant Field Values
-
REKEYED
- See Also:
- Constant Field Values
-
RESEED
- See Also:
- Constant Field Values
-
SOFT_RESTART
- See Also:
- Constant Field Values
-
STARTED
- See Also:
- Constant Field Values
-
STOPPED
- See Also:
- Constant Field Values
-
UPDATED
- See Also:
- Constant Field Values
-
WATCHDOG
- See Also:
- Constant Field Values
-
-
Constructor Details
-
EventLog
- Parameters:
file
- should be absolute
-
-
Method Details
-
addEvent
Append an event. Fails silently.- Parameters:
event
- no spaces, e.g. "started"- Throws:
IllegalArgumentException
- if event contains a space or newline
-
addEvent
Append an event. Fails silently.- Parameters:
event
- no spaces or newlines, e.g. "started"info
- no newlines, may be blank or null- Throws:
IllegalArgumentException
- if event contains a space or either contains a newline
-
getEvents
Caches. Fails silently.- Parameters:
event
- matching this event only, case sensitivesince
- since this time, 0 for all- Returns:
- non-null, Map of times to (possibly empty) info strings, sorted, earliest first, unmodifiable
-
getEvents
All events since a given time. Does not cache. Fails silently. Values in the returned map have the format "event[ info]". Events do not contain spaces.- Parameters:
since
- since this time, 0 for all- Returns:
- non-null, Map of times to info strings, sorted, earliest first, unmodifiable
- Since:
- 0.9.14
-
getLastEvent
Timestamp of last event.- Parameters:
event
- matching this event, case sensitivesince
- since this time, 0 for all- Returns:
- last event time, or 0 for none
- Since:
- 0.9.47
-