def counters(name,value=1): global slogin global flogin global saction global faction global clock mapping = { 'login-t': 'slogin', 'login-f': 'flogin', 'action-t': 'saction', 'action-f': 'faction', } with clock: globals()[mapping[name]] += value cli.show_status(slogin, flogin, saction, faction)
def signal_handler(sig, frame): cli.debug_mode = 1 cli.show_status(login_successful, login_failed, action_successful, action_faild)