(self, event, bundle_id, app_version, app_path)
Log application usage.

    Args:
      event: str, like "launch" or "quit"
      bundle_id: str
      app_version: str
      app_path: str
Log application usage.
Log application usage .
def LogApplicationUsage(self, event, bundle_id, app_version, app_path):
    """Log application usage.

    Args:
      event: str, like "launch" or "quit"
      bundle_id: str
      app_version: str
      app_path: str
    """
    if bundle_id is None and app_version is None and app_path is None:
      return

    try:
      now = int(time.time())
      conn = self._Connect()
      if not self._DetectApplicationUsageTable(conn):
        self._CreateApplicationUsageTable(conn)
      self._InsertApplicationUsage(
          conn,
          event, bundle_id, app_version, app_path, now)
      conn.commit()
    except sqlite3.OperationalError, e:
      logging.error('Error writing %s event to database: %s', event, e)
      self._Close(conn)
    except sqlite3.DatabaseError, e:
      if e.args[0] == 'database disk image is malformed':
        self._RecreateDatabase()
      logging.error('Database error: %s', e)
      self._Close(conn)
    self._Close(conn)
def LogApplicationUsage ( self , event , bundle_id , app_version , app_path ) : if bundle_id is None and app_version is None and app_path is None : return try : now = int ( time . time ( ) ) conn = self . _Connect ( ) if not self . _DetectApplicationUsageTable ( conn ) : self . _CreateApplicationUsageTable ( conn ) self . _InsertApplicationUsage ( conn , event , bundle_id , app_version , app_path , now ) conn . commit ( ) except sqlite3 . OperationalError , e : logging . error ( 'Error writing %s event to database: %s' , event , e ) self . _Close ( conn ) except sqlite3 . DatabaseError , e : if e . args [ 0 ] == 'database disk image is malformed' : self . _RecreateDatabase ( ) logging . error ( 'Database error: %s' , e ) self . _Close ( conn ) self . _Close ( conn )