Add Events Logging

This commit is contained in:
deathbybandaid 2019-05-08 13:59:54 -04:00
parent 7107ee6e98
commit 67a4025f83
2 changed files with 7 additions and 6 deletions

View File

@ -25,7 +25,7 @@ def bot_startup_connection(bot, trigger):
@sopel.module.event('1001')
@sopel.module.rule('.*')
def bot_events_start(bot, trigger):
bot_logging(bot, 'SpiceBot_Events', trigger.args[1])
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
bot_events_recieved(bot, trigger.event)
bot_events_trigger(bot, 1002, "Ready To Process module setup procedures")
@ -38,14 +38,14 @@ def bot_events_start(bot, trigger):
@sopel.module.event('1002')
@sopel.module.rule('.*')
def bot_events_ready(bot, trigger):
bot_logging(bot, 'SpiceBot_Events', trigger.args[1])
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
bot_events_recieved(bot, trigger.event)
@sopel.module.event('1003')
@sopel.module.rule('.*')
def bot_events_connected(bot, trigger):
bot_logging(bot, 'SpiceBot_Events', trigger.args[1])
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
bot_events_recieved(bot, trigger.event)
bot_events_setup_check(bot)
@ -68,5 +68,5 @@ def bot_events_connected(bot, trigger):
@sopel.module.event('1004')
@sopel.module.rule('.*')
def bot_events_complete(bot, trigger):
bot_logging(bot, 'SpiceBot_Events', trigger.args[1])
bot_logging(bot, 'SpiceBot_Events', trigger.args[1], True)
bot_events_recieved(bot, trigger.event)

View File

@ -99,7 +99,7 @@ def command_permissions_check(bot, trigger, privslist):
"""Logging"""
def bot_logging(bot, logtype, logentry):
def bot_logging(bot, logtype, logentry, stdio=False):
if 'SpiceBot_Logs' not in bot.memory:
bot.memory['SpiceBot_Logs'] = {"logs": {}, "queue": []}
@ -108,7 +108,8 @@ def bot_logging(bot, logtype, logentry):
bot.memory['SpiceBot_Logs']["queue"].append(logmessage)
# sopel.tools.stderr(logmessage)
if stdio:
sopel.tools.stderr(logmessage)
if logtype not in bot.memory['SpiceBot_Logs']["logs"].keys():
bot.memory['SpiceBot_Logs']["logs"][logtype] = []