1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-11 06:09:17 +00:00

refactor debug logging

This commit is contained in:
deadc0de6
2021-04-29 14:51:44 +02:00
parent d03bfaed6d
commit 8021a0e137
11 changed files with 198 additions and 305 deletions

View File

@@ -121,8 +121,8 @@ class Options(AttrMonitor):
self.args = docopt(USAGE, version=VERSION)
if args:
self.args = args.copy()
self.log = Logger()
self.debug = self.args['--verbose'] or ENV_DEBUG in os.environ
self.log = Logger(debug=self.debug)
self.dry = self.args['--dry']
if ENV_NODEBUG in os.environ:
# force disabling debugs
@@ -131,13 +131,12 @@ class Options(AttrMonitor):
self.confpath = self._get_config_path()
if not self.confpath:
raise YamlException('no config file found')
if self.debug:
self.log.dbg('#################################################')
self.log.dbg('#################### DOTDROP ####################')
self.log.dbg('#################################################')
self.log.dbg('version: {}'.format(VERSION))
self.log.dbg('command: {}'.format(' '.join(sys.argv)))
self.log.dbg('config file: {}'.format(self.confpath))
self.log.dbg('#################################################')
self.log.dbg('#################### DOTDROP ####################')
self.log.dbg('#################################################')
self.log.dbg('version: {}'.format(VERSION))
self.log.dbg('command: {}'.format(' '.join(sys.argv)))
self.log.dbg('config file: {}'.format(self.confpath))
self._read_config()
self._apply_args()