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 StringABORTEDfor convenience, not requiredstatic StringBECAME_FLOODFILLstatic StringCHANGE_IPstatic StringCHANGE_PORTstatic StringCLOCK_SHIFTstatic StringCRASHEDstatic StringCRITICALstatic StringINSTALL_FAILEDstatic StringINSTALLEDstatic StringNETWORKstatic StringNEW_IDENTstatic StringNOT_FLOODFILLstatic StringOOMstatic StringREACHABILITYstatic StringREKEYEDstatic StringRESEEDstatic StringSOFT_RESTARTstatic StringSTARTEDstatic StringSTOPPEDstatic StringUPDATEDstatic StringWATCHDOG -
Constructor Summary
Constructors Constructor Description EventLog(I2PAppContext ctx, File file) -
Method Summary
Modifier and Type Method Description voidaddEvent(String event)Append an event.voidaddEvent(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.longgetLastEvent(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
-