From 02fab2d04d4495b6f481f4f8d498341ea947dc85 Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 17 Feb 2012 11:11:28 +0100 Subject: [PATCH] Catch warnings --- couchpotato/core/logger.py | 3 +++ couchpotato/core/plugins/log/static/log.js | 1 + couchpotato/runner.py | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/couchpotato/core/logger.py b/couchpotato/core/logger.py index a6196f3e..2c539060 100644 --- a/couchpotato/core/logger.py +++ b/couchpotato/core/logger.py @@ -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) diff --git a/couchpotato/core/plugins/log/static/log.js b/couchpotato/core/plugins/log/static/log.js index bc8b3955..0bbb2682 100644 --- a/couchpotato/core/plugins/log/static/log.js +++ b/couchpotato/core/plugins/log/static/log.js @@ -66,6 +66,7 @@ Page.Log = new Class({ text = text.replace(/\u001b\[31m/gi, '') text = text.replace(/\u001b\[36m/gi, '') + text = text.replace(/\u001b\[33m/gi, '') text = text.replace(/\u001b\[0m\n/gi, '') text = text.replace(/\u001b\[0m/gi, '') diff --git a/couchpotato/runner.py b/couchpotato/runner.py index 513e86ef..6c817e0b 100644 --- a/couchpotato/runner.py +++ b/couchpotato/runner.py @@ -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')