Package com.yahoo.log.event
Class Event
java.lang.Object
com.yahoo.log.event.Event
- All Implemented Interfaces:
Serializable
The Event class is the base class for all VESPA defined events.
All specific Event classes extend this abstract class. An event
is more or less a type and a set of properties. For convenience
we use the logging system to transport Event instances, so the
typical use is to serialize events into the payload of log
messages.
Note that the static methods started(), stopped() etc are for use with this class so using them in the subclasses isn't really sanctioned. These methods are what the user wants to use for logging events, rather than making events him/herself and stuffing them through the logging API.
- Author:
- Bjorn Borud Only for internal Vespa usage
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic final void
Static method for logging the count event.static final void
Static method for logging the crash event.getName()
Get the name of the event instance.long
getTime()
Get the timestamp of this eventGet a property value.getValuePossiblyQuote
(String name) Convenience method which returns a property.int
Get the event version.static Event
Parse string representation of Event and emit correct Event subtype.static final void
Static method for logging the progress event.void
setTime
(long time) Set the timestamp of this event.Set a property.setVersion
(int version) Set event versionstatic final void
Static method for logging the started event.static final void
Static method for logging the starting event.static final void
Static method for logging the state event.static final void
Static method for logging the stopped event.static final void
Static method for logging the stopping event.toString()
This method returns the string representation of the event and must return something that can be parsed by the parse method.static final void
Static method for logging the value event.
-
Constructor Details
-
Event
protected Event()
-
-
Method Details
-
setValue
Set a property.- Parameters:
name
- The name of the propertyvalue
- The value of the property
-
getValue
Get a property value. -
setTime
public void setTime(long time) Set the timestamp of this event. -
getTime
public long getTime()Get the timestamp of this event- Returns:
- returns the timestamp of this event
-
setVersion
Set event version- Parameters:
version
- The version of the event.
-
getVersion
public int getVersion()Get the event version.- Returns:
- event version
-
getValuePossiblyQuote
Convenience method which returns a property. If the property contains whitespace the property will be enclosed in quotes. FIXME: quotes inside the value are not quoted -
getName
Get the name of the event instance.- Returns:
- the name of the event instance.
-
toString
This method returns the string representation of the event and must return something that can be parsed by the parse method. -
parse
Parse string representation of Event and emit correct Event subtype.- Parameters:
s
- A string containing an event- Returns:
- Event represented by
s
. - Throws:
MalformedEventException
- if unable to deciper Event from string.
-
starting
Static method for logging the starting event. -
started
Static method for logging the started event. -
stopping
Static method for logging the stopping event. -
stopped
Static method for logging the stopped event. -
count
Static method for logging the count event. -
value
Static method for logging the value event. -
progress
Static method for logging the progress event. -
state
Static method for logging the state event. -
crash
Static method for logging the crash event.
-