Enable debug by default and allow it to be disabled
This commit is contained in:
parent
1acdcb8bf2
commit
b7f8b6dc7f
1 changed files with 7 additions and 1 deletions
|
@ -44,6 +44,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
parser.add_argument("-d", "--data-folder", help='Define an alternate data folder location')
|
parser.add_argument("-d", "--data-folder", help='Define an alternate data folder location')
|
||||||
parser.add_argument("-D", "--debug", action='store_true', help='Use to enable DEBUG logging')
|
parser.add_argument("-D", "--debug", action='store_true', help='Use to enable DEBUG logging')
|
||||||
|
parser.add_argument("-ND", "--no_debug", action='store_true', help='Use to disable DEBUG logging')
|
||||||
|
|
||||||
opts = parser.parse_args()
|
opts = parser.parse_args()
|
||||||
|
|
||||||
|
@ -72,10 +73,15 @@ if __name__ == "__main__":
|
||||||
enable_opts = ['True', 'true', 'yes']
|
enable_opts = ['True', 'true', 'yes']
|
||||||
debug_opts = ['debug', 'Debug', 'DEBUG']
|
debug_opts = ['debug', 'Debug', 'DEBUG']
|
||||||
|
|
||||||
if not opts.debug:
|
opts.debug = True
|
||||||
|
|
||||||
|
if getenv('DEBUG') is not None:
|
||||||
opts.debug = True if any([getenv(string, False) for true in enable_opts
|
opts.debug = True if any([getenv(string, False) for true in enable_opts
|
||||||
for string in debug_opts if getenv(string, False) == true]) else False
|
for string in debug_opts if getenv(string, False) == true]) else False
|
||||||
|
|
||||||
|
elif opts.no_debug:
|
||||||
|
opts.debug = False
|
||||||
|
|
||||||
# Initiate the logger
|
# Initiate the logger
|
||||||
vl = VarkenLogger(data_folder=DATA_FOLDER, debug=opts.debug)
|
vl = VarkenLogger(data_folder=DATA_FOLDER, debug=opts.debug)
|
||||||
vl.logger.info('Starting Varken...')
|
vl.logger.info('Starting Varken...')
|
||||||
|
|
Loading…
Reference in a new issue