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
All Methods Instance Methods Concrete Methods 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 Detail
-
ABORTED
public static final String ABORTED
for convenience, not required- See Also:
- Constant Field Values
-
BECAME_FLOODFILL
public static final String BECAME_FLOODFILL
- See Also:
- Constant Field Values
-
CHANGE_IP
public static final String CHANGE_IP
- See Also:
- Constant Field Values
-
CHANGE_PORT
public static final String CHANGE_PORT
- See Also:
- Constant Field Values
-
CLOCK_SHIFT
public static final String CLOCK_SHIFT
- See Also:
- Constant Field Values
-
CRASHED
public static final String CRASHED
- See Also:
- Constant Field Values
-
CRITICAL
public static final String CRITICAL
- See Also:
- Constant Field Values
-
INSTALLED
public static final String INSTALLED
- See Also:
- Constant Field Values
-
INSTALL_FAILED
public static final String INSTALL_FAILED
- See Also:
- Constant Field Values
-
NETWORK
public static final String NETWORK
- See Also:
- Constant Field Values
-
NEW_IDENT
public static final String NEW_IDENT
- See Also:
- Constant Field Values
-
NOT_FLOODFILL
public static final String NOT_FLOODFILL
- See Also:
- Constant Field Values
-
OOM
public static final String OOM
- See Also:
- Constant Field Values
-
REACHABILITY
public static final String REACHABILITY
- See Also:
- Constant Field Values
-
REKEYED
public static final String REKEYED
- See Also:
- Constant Field Values
-
RESEED
public static final String RESEED
- See Also:
- Constant Field Values
-
SOFT_RESTART
public static final String SOFT_RESTART
- See Also:
- Constant Field Values
-
STARTED
public static final String STARTED
- See Also:
- Constant Field Values
-
STOPPED
public static final String STOPPED
- See Also:
- Constant Field Values
-
UPDATED
public static final String UPDATED
- See Also:
- Constant Field Values
-
WATCHDOG
public static final String WATCHDOG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EventLog
public EventLog(I2PAppContext ctx, File file)
- Parameters:
file
- should be absolute
-
-
Method Detail
-
addEvent
public void addEvent(String event)
Append an event. Fails silently.- Parameters:
event
- no spaces, e.g. "started"- Throws:
IllegalArgumentException
- if event contains a space or newline
-
addEvent
public void addEvent(String event, String info)
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
public SortedMap<Long,String> getEvents(String event, long since)
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
public SortedMap<Long,String> getEvents(long since)
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
public long getLastEvent(String event, long since)
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
-
-