Skip to content

Commit

Permalink
Add -W flag to vpoller-worker for logging only warning and error mess…
Browse files Browse the repository at this point in the history
…ages
  • Loading branch information
dnaeon committed Jul 11, 2014
1 parent 106bc23 commit b434f4e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/vpoller-worker
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def status(endpoint):

def main():
usage="""
Usage: vpoller-worker [-d] [-D] [-p <pidfile>] [-f <config>] [-o <logfile>] start
Usage: vpoller-worker [-d] [-D|-W] [-p <pidfile>] [-f <config>] [-o <logfile>] start
vpoller-worker [-D] -e <endpoint> stop
vpoller-worker [-D] -e <endpoint> status
vpoller-worker --help
Expand All @@ -114,6 +114,7 @@ Options:
-d, --daemon Start as a daemon, otherwise
run in the foreground
-D, --debug Debug mode, be more verbose
-W, --warning Log only warning and error messages
-p <pidfile>, --pidfile <pidfile> Specify pidfile file to use
[default: /var/run/vpoller/vpoller-worker.pid]
-f <config>, --file <config> Specify config file to use
Expand All @@ -125,7 +126,12 @@ Options:

args = docopt(usage, version="0.1.0")

level = logging.DEBUG if args['--debug'] else logging.INFO
if args['--debug']:
level = logging.DEBUG
elif args['--warning']:
level = logging.WARNING
else:
level = logging.INFO

logging.basicConfig(
filename=args['--output'],
Expand Down

0 comments on commit b434f4e

Please sign in to comment.