3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 13:09:23 +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
import traceback
import utils
from log import log
@ -33,7 +31,7 @@ def handle_commands(irc, source, command, args):
try:
func(irc, source, cmd_args)
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)))
return
utils.add_hook(handle_commands, 'PRIVMSG')

View File

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