3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

main/coreplugin: use log.exception() instead of traceback.print_exc()

This fixes tracebacks only being sent to console, and not the log file.
This commit is contained in:
James Lu 2015-07-18 20:12:13 -07:00
parent 61804b1ecd
commit 536366de99
2 changed files with 2 additions and 5 deletions

View File

@ -1,7 +1,5 @@
## coreplugin.py - Core PyLink plugin ## coreplugin.py - Core PyLink plugin
import traceback
import utils import utils
from log import log from log import log
@ -33,7 +31,7 @@ def handle_commands(irc, source, command, args):
try: try:
func(irc, source, cmd_args) func(irc, source, cmd_args)
except Exception as e: except Exception as e:
traceback.print_exc() log.exception('Unhandled exception caught in command %r' % cmd)
utils.msg(irc, source, 'Uncaught exception in command %r: %s: %s' % (cmd, type(e).__name__, str(e))) utils.msg(irc, source, 'Uncaught exception in command %r: %s: %s' % (cmd, type(e).__name__, str(e)))
return return
utils.add_hook(handle_commands, 'PRIVMSG') utils.add_hook(handle_commands, 'PRIVMSG')

View File

@ -7,7 +7,6 @@ import time
import sys import sys
from collections import defaultdict from collections import defaultdict
import threading import threading
import traceback
from log import log from log import log
import conf import conf
@ -152,7 +151,7 @@ class Irc():
hook_func(self, numeric, command, parsed_args) hook_func(self, numeric, command, parsed_args)
except Exception: except Exception:
# We don't want plugins to crash our servers... # We don't want plugins to crash our servers...
traceback.print_exc() log.exception('Unhandled exception caught in %r' % hook_func)
continue continue
def send(self, data): def send(self, data):