From 5883164f22e8b092effaa9185dd5b8379d01e8da Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Fri, 7 Aug 2009 09:36:07 -0700 Subject: Turn on debugging with -d instead of having to edit the script diff --git a/fusearchive.py b/fusearchive.py index d599370..ab13f0d 100755 --- a/fusearchive.py +++ b/fusearchive.py @@ -10,14 +10,6 @@ import logging, sys, os, fuse import FuseArchive -log_level = logging.DEBUG -#log_level = logging.WARNING - -logging.basicConfig( level = log_level, - format = '%(asctime)s %(levelname)s %(filename)s:%(lineno)d %(module)s:%(funcName)s() %(message)s', - stream = sys.stderr, - filemode = 'w' ) - enable_stats = False enable_psyco = False @@ -49,10 +41,22 @@ server.multithreaded = False server.parse(values=server, errex=1) -if len(server.parser.largs) != 2: +if server.parser.largs == None or len(server.parser.largs) != 2: print "Usage: " + sys.argv[0] + " storageDirectory mountDirectory" sys.exit(1) +log_level = logging.WARNING +# If debug is in the assembed opts then enable our debug too +print server.fuse_args.assemble() +if ' '.join( server.fuse_args.assemble() ).find( 'debug' ): + log_level = logging.DEBUG + +logging.basicConfig( level = log_level, + format = '%(asctime)s %(levelname)s %(filename)s:%(lineno)d %(module)s:%(funcName)s() %(message)s', + stream = sys.stderr, + filemode = 'w' ) + +# Get backing store directory server.root = server.parser.largs[0] try: -- cgit v0.10.2