mirror of https://github.com/rq/rq.git
Allow rqworker to run more silently.
This commit is contained in:
parent
8005759cce
commit
a04169e561
|
@ -8,7 +8,7 @@ except ImportError:
|
|||
from rq.compat.dictconfig import dictConfig # noqa
|
||||
|
||||
|
||||
def setup_loghandlers(verbose=False):
|
||||
def setup_loghandlers(level=None):
|
||||
if not logging._handlers:
|
||||
dictConfig({
|
||||
"version": 1,
|
||||
|
@ -33,6 +33,6 @@ def setup_loghandlers(verbose=False):
|
|||
|
||||
"root": {
|
||||
"handlers": ["console"],
|
||||
"level": "DEBUG" if verbose else "INFO"
|
||||
"level": level or "INFO",
|
||||
}
|
||||
})
|
||||
|
|
|
@ -24,6 +24,7 @@ def parse_args():
|
|||
parser.add_argument('--name', '-n', default=None, help='Specify a different name')
|
||||
parser.add_argument('--path', '-P', default='.', help='Specify the import path.')
|
||||
parser.add_argument('--verbose', '-v', action='store_true', default=False, help='Show more output')
|
||||
parser.add_argument('--quiet', '-q', action='store_true', default=False, help='Show less output')
|
||||
parser.add_argument('--sentry-dsn', action='store', default=None, metavar='URL', help='Report exceptions to this Sentry DSN')
|
||||
parser.add_argument('queues', nargs='*', help='The queues to listen on (default: \'default\')')
|
||||
|
||||
|
@ -46,7 +47,16 @@ def main():
|
|||
if args.sentry_dsn is None:
|
||||
args.sentry_dsn = settings.get('SENTRY_DSN', None)
|
||||
|
||||
setup_loghandlers(args.verbose)
|
||||
if args.verbose and args.quiet:
|
||||
raise RuntimeError("Flags --verbose and --quiet are mutually exclusive.")
|
||||
|
||||
if args.verbose:
|
||||
level = 'DEBUG'
|
||||
elif args.quiet:
|
||||
level = 'WARNING'
|
||||
else:
|
||||
level = 'INFO'
|
||||
setup_loghandlers(level)
|
||||
setup_redis(args)
|
||||
|
||||
cleanup_ghosts()
|
||||
|
|
Loading…
Reference in New Issue