Commit 4e9c0c73 authored by Aurel's avatar Aurel

allow to pass a logfile as parameter


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@227 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent ecf1ef1a
......@@ -28,16 +28,18 @@ parser.add_option('-v', '--verbose', action = 'store_true',
help = 'print verbose messages')
parser.add_option('-c', '--config', help = 'specify a configuration file')
parser.add_option('-s', '--section', help = 'specify a configuration section')
parser.add_option('-l', '--logfile', help = 'specify a logging file')
(options, args) = parser.parse_args()
config = options.config or 'neo.conf'
section = options.section or 'master'
logfile = options.logfile or None
if options.verbose:
logging.basicConfig(level = logging.DEBUG)
logging.basicConfig(filename = logfile, level = logging.DEBUG)
else:
logging.basicConfig(level = logging.WARNING)
logging.basicConfig(filename = logfile, level = logging.WARNING)
app = Application(config, section)
app.run()
......@@ -28,6 +28,7 @@ parser.add_option('-v', '--verbose', action = 'store_true',
help = 'print verbose messages')
parser.add_option('-c', '--config', help = 'specify a configuration file')
parser.add_option('-s', '--section', help = 'specify a configuration section')
parser.add_option('-l', '--logfile', help = 'specify a logging file')
parser.add_option('-R', '--reset', action = 'store_true',
help = 'remove an existing database if any')
......@@ -35,11 +36,12 @@ parser.add_option('-R', '--reset', action = 'store_true',
config = options.config or 'neo.conf'
section = options.section or 'storage'
logfile = options.logfile or None
if options.verbose:
logging.basicConfig(level = logging.DEBUG)
logging.basicConfig(filename = logfile, level = logging.DEBUG)
else:
logging.basicConfig(level = logging.WARNING)
logging.basicConfig(filename = logfile, level = logging.WARNING)
app = Application(config, section, options.reset)
app.run()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment