Library: events

From Yombo
Jump to: navigation, search
Commonly Used Yes
Status Active

Log various events. Used to instrument the system for performance and system logging.


Used to logs system events, capture metrics, and general software instrumentation. Events are different than notifications since events don't generate notifications to display to the user.


No hooks registered.


There are two steps to utilize events. First is define a new event type within the module by implementing the '_event_types_' hook. This example adds a new event type "module_alexa" with a single sub-type of "control":

Step 1: Create new event type

 1 def _event_types_(self, **kwargs):
 2     """
 3     Add Alexa usage instrumentation.
 5     :param kwargs:
 6     :return:
 7     """
 8     return {
 9         'module_alexa': {
10             'control': {
11                 'description': "Tracks device control usage.",
12                 'attributes': (
13                     'command',
14                     'item_type',
15                     'item_id',
16                 ),
17                 'expires': 0,
18             },
19         },
20     }

Step 2: Create event entries

To create a new event entry, use the _Events magic attribute to access the events library and call the 'new' method.'module_alexa', 'control', ('off', 'device', 'abc123'))

This page was last edited on 24 October 2018.