You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
851 B
Python

from core.main import *
def event(name, eventType):
if not "local" in counters.keys():
counters["local"] = {}
if not "global" in counters.keys():
counters["global"] = {}
if not name in counters["local"].keys():
counters["local"][name] = {}
if eventType not in counters["local"][name].keys():
counters["local"][name][eventType] = 0
if eventType not in counters["global"]:
counters["global"][eventType] = 0
counters["local"][name][eventType] += 1
counters["global"][eventType] += 1
def getEvents(name=None):
if name == None:
if "global" in counters.keys():
return counters["global"]
else:
return None
else:
if name in counters["local"].keys():
return counters["local"][name]
else:
return None