def event(self, name, etype, **info):
        """
        Records an event to MongoDB. Events can be later viewed in web status.
        Parameters:
            name: the name of the event, for example, "Work".
            etype: the type of the event, can be either "begin", "end" or
            "single".
            info: any extra event attributes.
        """
        if etype not in ("begin", "end", "single"):
            raise ValueError("Event type must any of the following: 'begin', "
                             "'end', 'single'")
        for handler in logging.getLogger().handlers:
            if isinstance(handler, MongoLogHandler):
                data = {"session": handler.log_id,
                        "instance": handler.node_id,
                        "time": time(),
                        "domain": self.__class__.__name__,
                        "name": name,
                        "type": etype}
                dupkeys = set(data.keys()).intersection(set(info.keys()))
                if len(dupkeys) > 0:
                    raise ValueError("Event kwargs may not contain %s" %
                                     dupkeys)
                data.update(info)
                handler.events.insert(data, w=0)
def event ( self , name , etype , ** info ) : if etype not in ( "begin" , "end" , "single" ) : raise ValueError ( "Event type must any of the following: 'begin', " "'end', 'single'" ) for handler in logging . getLogger ( ) . handlers : if isinstance ( handler , MongoLogHandler ) : data = { "session" : handler . log_id , "instance" : handler . node_id , "time" : time ( ) , "domain" : self . __class__ . __name__ , "name" : name , "type" : etype } dupkeys = set ( data . keys ( ) ) . intersection ( set ( info . keys ( ) ) ) if len ( dupkeys ) > 0 : raise ValueError ( "Event kwargs may not contain %s" % dupkeys ) data . update ( info ) handler . events . insert ( data , w = 0 )
Records an event to MongoDB. Events can be later viewed in web status.
        Parameters:
            name: the name of the event, for example, "Work".
            etype: the type of the event, can be either "begin", "end" or
            "single".
            info: any extra event attributes.