server/serverctl.py
changeset 10411 4ee15441f2eb
parent 10354 635cfac73d28
parent 10400 383a5e629145
child 10489 8a2e2efe9362
--- a/server/serverctl.py	Mon Jun 22 14:15:16 2015 +0200
+++ b/server/serverctl.py	Mon Jun 22 14:27:37 2015 +0200
@@ -972,13 +972,19 @@
     name = 'source-sync'
     arguments = '<instance> <source>'
     min_args = max_args = 2
+    options = (
+            ('loglevel',
+             {'short': 'l', 'type' : 'choice', 'metavar': '<log level>',
+              'default': 'info', 'choices': ('debug', 'info', 'warning', 'error'),
+             }),
+    )
 
     def run(self, args):
+        from cubicweb.cwctl import init_cmdline_log_threshold
         config = ServerConfiguration.config_for(args[0])
         config.global_set_option('log-file', None)
         config.log_format = '%(levelname)s %(name)s: %(message)s'
-        logger = logging.getLogger('cubicweb.sources')
-        logger.setLevel(logging.INFO)
+        init_cmdline_log_threshold(config, self['loglevel'])
         # only retrieve cnx to trigger authentication, close it right away
         repo, cnx = repo_cnx(config)
         cnx.close()