# HG changeset patch # User David Douard <david.douard@logilab.fr> # Date 1450178087 -3600 # Node ID 2018cdf2909eddf03aa5b30d77cc80168a1489fe # Parent c8893a0bcd42910d8061ba6397a577b3ca5915fa [cc] add a dbglevel cmdline option to specify the DBG_XXX flags to set also display the list of valid loglevel values in the help message. diff -r c8893a0bcd42 -r 2018cdf2909e ccplugin.py --- a/ccplugin.py Thu Feb 18 16:38:11 2016 +0100 +++ b/ccplugin.py Tue Dec 15 12:14:47 2015 +0100 @@ -20,12 +20,15 @@ from cubicweb.__pkginfo__ import numversion as cwversion from cubicweb.cwconfig import CubicWebConfiguration as cwcfg from cubicweb.cwctl import CWCTL, InstanceCommand, init_cmdline_log_threshold +from cubicweb.server import set_debug from pyramid_cubicweb import wsgi_application_from_cwconfig import waitress MAXFD = 1024 +DBG_FLAGS = ('RQL', 'SQL', 'REPO', 'HOOKS', 'OPS', 'SEC', 'MORE') +LOG_LEVELS = ('debug', 'info', 'warning', 'error') class PyramidStartHandler(InstanceCommand): """Start an interactive pyramid server. @@ -57,8 +60,15 @@ 'help': 'Interval, in seconds, between file modifications checks'}), ('loglevel', {'short': 'l', 'type': 'choice', 'metavar': '<log level>', - 'default': None, 'choices': ('debug', 'info', 'warning', 'error'), - 'help': 'debug if -D is set, error otherwise', + 'default': None, 'choices': LOG_LEVELS, + 'help': 'debug if -D is set, error otherwise; one of %s' % (LOG_LEVELS,), + }), + ('dbglevel', + {'type': 'multiple_choice', 'metavar': '<dbg level>', + 'default': None, + 'choices': DBG_FLAGS, + 'help': ('Set the server debugging flags; you may choose several ' + 'values in %s; imply "debug" loglevel' % (DBG_FLAGS,)), }), ('profile', {'action': 'store_true', @@ -306,6 +316,9 @@ self.daemonize(cwconfig['pid-file']) self.record_pid(cwconfig['pid-file']) + if self['dbglevel']: + self['loglevel'] = 'debug' + set_debug('|'.join('DBG_'+ x.upper() for x in self['dbglevel'])) init_cmdline_log_threshold(cwconfig, self['loglevel']) app = wsgi_application_from_cwconfig(