use logging instead of printing to stderr
This commit is contained in:
parent
7d698192f3
commit
683979a839
2 changed files with 16 additions and 5 deletions
|
|
@ -20,10 +20,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
|
|
||||||
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from weboob.tools.application import PromptApplication
|
from weboob.tools.application import PromptApplication
|
||||||
from weboob.capabilities.dating import ICapDating
|
from weboob.capabilities.dating import ICapDating
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['HaveSex']
|
||||||
|
|
||||||
|
|
||||||
class HaveSex(PromptApplication):
|
class HaveSex(PromptApplication):
|
||||||
APPNAME = 'havesex'
|
APPNAME = 'havesex'
|
||||||
VERSION = '1.0'
|
VERSION = '1.0'
|
||||||
|
|
@ -77,4 +83,4 @@ class HaveSex(PromptApplication):
|
||||||
elif action == 'stop':
|
elif action == 'stop':
|
||||||
self.service('Stopping walker', 'stop_profiles_walker')
|
self.service('Stopping walker', 'stop_profiles_walker')
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'Syntax: walker (start|stop)'
|
logging.error(u'Syntax: walker (start|stop)')
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import weboob
|
import weboob
|
||||||
from weboob.tools.application import ConsoleApplication
|
from weboob.tools.application import ConsoleApplication
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['WeboobCfg']
|
||||||
|
|
||||||
|
|
||||||
class WeboobCfg(ConsoleApplication):
|
class WeboobCfg(ConsoleApplication):
|
||||||
APPNAME = 'weboobcfg'
|
APPNAME = 'weboobcfg'
|
||||||
VERSION = '1.0'
|
VERSION = '1.0'
|
||||||
|
|
@ -70,7 +75,7 @@ class WeboobCfg(ConsoleApplication):
|
||||||
try:
|
try:
|
||||||
module = self.weboob.modules_loader.get_or_load_module(name)
|
module = self.weboob.modules_loader.get_or_load_module(name)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print >>sys.stderr, 'No such module: %s' % name
|
logging.error('No such module: %s' % name)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
print '.------------------------------------------------------------------------------.'
|
print '.------------------------------------------------------------------------------.'
|
||||||
|
|
@ -105,14 +110,14 @@ class WeboobCfg(ConsoleApplication):
|
||||||
try:
|
try:
|
||||||
key, value = param.split('=', 1)
|
key, value = param.split('=', 1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print >>sys.stderr, "Parameters have to be in form 'key=value'"
|
logging.error("Parameters have to be in form 'key=value'")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
params[key] = value
|
params[key] = value
|
||||||
try:
|
try:
|
||||||
self.weboob.backends_config.add_backend(name, type, params)
|
self.weboob.backends_config.add_backend(name, type, params)
|
||||||
except ConfigParser.DuplicateSectionError, e:
|
except ConfigParser.DuplicateSectionError, e:
|
||||||
print >>sys.stderr, 'Error: %s (filename=%s)' % (e, self.weboob.backends_config.confpath)
|
logging.error('Error: %s (filename=%s)' % (e, self.weboob.backends_config.confpath))
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@ConsoleApplication.command('List backends')
|
@ConsoleApplication.command('List backends')
|
||||||
|
|
@ -129,5 +134,5 @@ class WeboobCfg(ConsoleApplication):
|
||||||
try:
|
try:
|
||||||
self.weboob.backends_config.remove_backend(name)
|
self.weboob.backends_config.remove_backend(name)
|
||||||
except ConfigParser.NoSectionError:
|
except ConfigParser.NoSectionError:
|
||||||
print >>sys.stderr, "Backend '%s' does not exist" % name
|
logging.error("Backend '%s' does not exist" % name)
|
||||||
return 1
|
return 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue