Catch warnings
This commit is contained in:
@@ -22,6 +22,9 @@ class CPLog(object):
|
||||
def error(self, msg):
|
||||
self.logger.error(self.addContext(msg))
|
||||
|
||||
def warning(self, msg):
|
||||
self.logger.warning(self.addContext(msg))
|
||||
|
||||
def critical(self, msg):
|
||||
self.logger.critical(self.addContext(msg), exc_info = 1)
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ Page.Log = new Class({
|
||||
|
||||
text = text.replace(/\u001b\[31m/gi, '</span><span class="error">')
|
||||
text = text.replace(/\u001b\[36m/gi, '</span><span class="debug">')
|
||||
text = text.replace(/\u001b\[33m/gi, '</span><span class="debug">')
|
||||
text = text.replace(/\u001b\[0m\n/gi, '</span><span class="time">')
|
||||
text = text.replace(/\u001b\[0m/gi, '</span><span>')
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import logging
|
||||
import os.path
|
||||
import sys
|
||||
import time
|
||||
import warnings
|
||||
|
||||
def getOptions(base_path, args):
|
||||
|
||||
@@ -133,6 +134,10 @@ def runCouchPotato(options, base_path, args, desktop = None):
|
||||
log = CPLog(__name__)
|
||||
log.debug('Started with options %s' % options)
|
||||
|
||||
def customwarn(message, category, filename, lineno, file = None, line = None):
|
||||
log.warning('%s %s %s line:%s' % (category, message, filename, lineno))
|
||||
warnings.showwarning = customwarn
|
||||
|
||||
|
||||
# Load configs & plugins
|
||||
loader = Env.get('loader')
|
||||
|
||||
Reference in New Issue
Block a user