cz.cuni.amis.pogamut.base.utils.logging.marks
Class LogEventMark

Package class diagram package LogEventMark
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.utils.logging.marks.LogEventMark
All Implemented Interfaces:
Serializable

public class LogEventMark
extends Object
implements Serializable

DO NOT USE THIS CLASS!! Use methods in LogCategory to add events to the log.

This class is special parameter of the LogRecord that means some kind of event has happend to the agent. The handler of log records can do some nifty stuff when he finds this object as parameter of LogRecord, like showing in some GUI.

Under normal circumstances, you create new mark using one of create* methods, pass it as parameter of some log message, it gets transfered (probably through JMX) to some handler on the other side (in our particular case to Netbeans plugin and timeline), where some handler will look for LogRecords with this object as one of parameters and when it finds it, it shows the mark in some GUI. // create an event that with text "Text of event for GUI" that will be // shown for duration of 2 seconds. logger.info("Text of event for text logger" , new Object[]{LogEventMark.createFixedLengthEvent(Level.INFO, "Text of event for GUI", null, 2000)});

Author:
Honza
See Also:
LogMapMark, Serialized Form

Nested Class Summary
static class LogEventMark.Type
          Type of LogEventMark.
 
Method Summary
static LogEventMark createFixedLengthEvent(Level level, String text, long duration)
          Create log event that will last for some time.
static LogEventMark createSingleLengthEvent(Level level, String text)
          Create single event.
static LogEventMark createVariableLengthEvent(Level level, String text)
          Create log event that will last until notified it should stop.
 boolean equals(Object otherObject)
           
 long getDuration()
           
 LogEventMark getEndMark()
          Get ending mark for variable length event.
 int getId()
          Get unique id of event.
 Level getLevel()
          What is level of this event?
 String getText()
           
 long getTime()
           
 LogEventMark.Type getType()
           
 int hashCode()
           
 String toString()
          Get human readable representation of LogEventMark.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createSingleLengthEvent

public static LogEventMark createSingleLengthEvent(Level level,
                                                   String text)
Create single event. Such event has no duration.

Parameters:
level - level of log event, should be same as carrying LogRecord.
text - text of single event
Returns:
created single event.

createFixedLengthEvent

public static LogEventMark createFixedLengthEvent(Level level,
                                                  String text,
                                                  long duration)
Create log event that will last for some time.

Parameters:
level - level of log event, should be same as carrying LogRecord.
text - Text of event
duration - how long should event last.

createVariableLengthEvent

public static LogEventMark createVariableLengthEvent(Level level,
                                                     String text)
Create log event that will last until notified it should stop. In order to stop the event, create end mark of event using getEndMark().

Parameters:
level - level of log event, should be same as carrying LogRecord.
text - text of event.
Returns:
created event.

toString

public String toString()
Get human readable representation of LogEventMark.

Overrides:
toString in class Object

getId

public int getId()
Get unique id of event. Start and end marks of variable event have same id, because they mark same event.


getLevel

public Level getLevel()
What is level of this event?

Returns:
level of event.

getText

public String getText()
Returns:
the message of this event

getTime

public long getTime()
Returns:
when does event start

getType

public LogEventMark.Type getType()
Returns:
the type of event

getDuration

public long getDuration()
Returns:
the duration of event. 0 for single event, Integer.MAX_VALUE for variable length event

getEndMark

public LogEventMark getEndMark()
Get ending mark for variable length event.

Returns:
if this mark is start mark, create new end mark, if this mark is end mark, return this mark (since we already are end mark).
Throws:
IllegalStateException - if type of mark is not start or end.

equals

public boolean equals(Object otherObject)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.