Package com.brightcove.player.event
Class EventLogger
java.lang.Object
com.brightcove.player.event.EventLogger
Simple class that can be used to listen to and log out information on all emitted events. By
default the BUFFERED_UPDATE, PROGRESS and AD_PROGRESS events are excluded because they are extremely chatty.
They can be displayed by calling removeExclude(type).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThis interface provides a way implement alternative logging. -
Constructor Summary
ConstructorsConstructorDescriptionEventLogger(EventEmitter emitterValue, boolean verboseValue) Creates a new EventLogger object.EventLogger(EventEmitter emitterValue, boolean verboseValue, EventLogger.LoggerCallback callback) Creates a new EventLogger object.EventLogger(EventEmitter emitterValue, boolean verboseValue, String tagValue) Creates a new EventLogger object.EventLogger(EventEmitter emitterValue, boolean verboseValue, String tagValue, EventLogger.LoggerCallback callback) Creates a new EventLogger object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExclude(String value) By passing this method a specificEventType, that type will not be logged.voidaddWhitelist(String value) Adds a specificEventTypeto the whitelist.voidRemoves allEventTypeadded withaddExclude(String).voidRemoves allEventTypetypes registered with the whitelist.voidremoveExclude(String value) Removes anEventTypethat was previously added withaddExclude(String).voidremoveFromWhitelist(String value) Removes a specificEventTypefrom the whitelist.voidsetVerbose(boolean value) Sets whether or not properties on events should be logged.voidstart()voidstop()Stops writing log messages.
-
Constructor Details
-
EventLogger
Creates a new EventLogger object.- Parameters:
emitterValue- TheEventEmitterobject to listen for events to log.verboseValue- If true, will log all the properties for each event.
-
EventLogger
public EventLogger(EventEmitter emitterValue, boolean verboseValue, EventLogger.LoggerCallback callback) Creates a new EventLogger object.- Parameters:
emitterValue- TheEventEmitterobject to listen for events to log.verboseValue- If true, will log all the properties for each event.callback- AEventLogger.LoggerCallbackinstance which will be called when a message or error should be logged.
-
EventLogger
Creates a new EventLogger object.- Parameters:
emitterValue- TheEventEmitterobject to listen for events to log.verboseValue- If true, will log all the properties for each event.tagValue- The name of the tag to use when writing messages to logcat.
-
EventLogger
public EventLogger(EventEmitter emitterValue, boolean verboseValue, String tagValue, EventLogger.LoggerCallback callback) Creates a new EventLogger object.- Parameters:
emitterValue- TheEventEmitterobject to listen for events to log.verboseValue- If true, will log all the properties for each event.tagValue- The name of the tag to use when writing messages to logcat.callback- AEventLogger.LoggerCallbackinstance which will be called when a message or error should be logged. This can be null.
-
-
Method Details
-
setVerbose
public void setVerbose(boolean value) Sets whether or not properties on events should be logged.- Parameters:
value- If true, will log all properties.
-
start
public void start() -
stop
public void stop()Stops writing log messages. -
addExclude
By passing this method a specificEventType, that type will not be logged.- Parameters:
value- TheEventTypeto exclude from the log.
-
removeExclude
Removes anEventTypethat was previously added withaddExclude(String).- Parameters:
value- TheEventTypeto remove.
-
clearExcludes
public void clearExcludes()Removes allEventTypeadded withaddExclude(String). -
addWhitelist
Adds a specificEventTypeto the whitelist. If EventTypes are added to the whitelist, ONLY those EventTypes will be logged. All other Events will be ignored. By default, no EventTypes are whitelisted.- Parameters:
value- TheEventTypeto add to the whitelist.
-
removeFromWhitelist
Removes a specificEventTypefrom the whitelist.- Parameters:
value- TheEventTypeto remove.
-
clearWhitelist
public void clearWhitelist()Removes allEventTypetypes registered with the whitelist. After calling this, all EventTypes will be logged (except those registered withaddExclude(String).
-