Catch warnings

This commit is contained in:
Ruud
2012-02-17 11:11:28 +01:00
parent 456b44e80f
commit 02fab2d04d
3 changed files with 9 additions and 0 deletions
+5
View File
@@ -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')