From 7eabd2856753c73a818159e7cb3316148ca600dc Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 15 Nov 2020 15:14:14 +0100 Subject: Tweak log levels. Use info for changes performed (e.g. changes to the filesystem, code executed). Use verbose for "nothing to do" messages. --- dotbot/cli.py | 2 +- dotbot/dispatcher.py | 2 +- dotbot/plugins/clean.py | 4 ++-- dotbot/plugins/create.py | 4 ++-- dotbot/plugins/link.py | 6 +++--- dotbot/plugins/shell.py | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dotbot/cli.py b/dotbot/cli.py index 32db016..0795d40 100644 --- a/dotbot/cli.py +++ b/dotbot/cli.py @@ -100,7 +100,7 @@ def main(): dispatcher = Dispatcher(base_directory, only=options.only, skip=options.skip) success = dispatcher.dispatch(tasks) if success: - log.info('\n==> All tasks executed successfully') + log.verbose('\n==> All tasks executed successfully') else: raise DispatchError('\n==> Some tasks were not executed successfully') except (ReadingError, DispatchError) as e: diff --git a/dotbot/dispatcher.py b/dotbot/dispatcher.py index 10e4293..f809bef 100644 --- a/dotbot/dispatcher.py +++ b/dotbot/dispatcher.py @@ -24,7 +24,7 @@ class Dispatcher(object): for action in task: if self._only is not None and action not in self._only \ or self._skip is not None and action in self._skip: - self._log.info('Skipping action %s' % action) + self._log.verbose('Skipping action %s' % action) continue handled = False if action == 'defaults': diff --git a/dotbot/plugins/clean.py b/dotbot/plugins/clean.py index c2793e5..e7f1561 100644 --- a/dotbot/plugins/clean.py +++ b/dotbot/plugins/clean.py @@ -28,7 +28,7 @@ class Clean(dotbot.Plugin): recursive = targets[target].get('recursive', recursive) success &= self._clean(target, force, recursive) if success: - self._log.info('All targets have been cleaned') + self._log.verbose('All targets have been cleaned') else: self._log.error('Some targets were not successfully cleaned') return success @@ -51,7 +51,7 @@ class Clean(dotbot.Plugin): if not os.path.exists(path) and os.path.islink(path): points_at = os.path.join(os.path.dirname(path), os.readlink(path)) if self._in_directory(path, self._context.base_directory()) or force: - self._log.verbose('Removing invalid link %s -> %s' % (path, points_at)) + self._log.info('Removing invalid link %s -> %s' % (path, points_at)) os.remove(path) else: self._log.verbose('Link %s -> %s not removed.' % (path, points_at)) diff --git a/dotbot/plugins/create.py b/dotbot/plugins/create.py index eee6e17..7e39c1a 100644 --- a/dotbot/plugins/create.py +++ b/dotbot/plugins/create.py @@ -23,7 +23,7 @@ class Create(dotbot.Plugin): path = os.path.expandvars(os.path.expanduser(path)) success &= self._create(path) if success: - self._log.info('All paths have been set up') + self._log.verbose('All paths have been set up') else: self._log.error('Some paths were not successfully set up') return success @@ -40,7 +40,7 @@ class Create(dotbot.Plugin): if not self._exists(path): self._log.debug('Trying to create path %s' % path) try: - self._log.verbose('Creating path %s' % path) + self._log.info('Creating path %s' % path) os.makedirs(path) except OSError: self._log.warning('Failed to create path %s' % path) diff --git a/dotbot/plugins/link.py b/dotbot/plugins/link.py index 45b893f..4112fe5 100644 --- a/dotbot/plugins/link.py +++ b/dotbot/plugins/link.py @@ -100,7 +100,7 @@ class Link(dotbot.Plugin): success &= self._delete(path, destination, relative, canonical_path, force) success &= self._link(path, destination, relative, canonical_path, ignore_missing) if success: - self._log.info('All links have been set up') + self._log.verbose('All links have been set up') else: self._log.error('Some links were not successfully set up') return success @@ -152,7 +152,7 @@ class Link(dotbot.Plugin): self._log.warning('Failed to create directory %s' % parent) success = False else: - self._log.verbose('Creating directory %s' % parent) + self._log.info('Creating directory %s' % parent) return success def _delete(self, source, path, relative, canonical_path, force): @@ -180,7 +180,7 @@ class Link(dotbot.Plugin): success = False else: if removed: - self._log.verbose('Removing %s' % path) + self._log.info('Removing %s' % path) return success def _relative_path(self, source, destination): diff --git a/dotbot/plugins/shell.py b/dotbot/plugins/shell.py index c1575ff..6fe79b8 100644 --- a/dotbot/plugins/shell.py +++ b/dotbot/plugins/shell.py @@ -42,11 +42,11 @@ class Shell(dotbot.Plugin): cmd = item msg = None if msg is None: - self._log.verbose(cmd) + self._log.info(cmd) elif quiet: - self._log.verbose('%s' % msg) + self._log.info('%s' % msg) else: - self._log.verbose('%s [%s]' % (msg, cmd)) + self._log.info('%s [%s]' % (msg, cmd)) ret = dotbot.util.shell_command( cmd, cwd=self._context.base_directory(), @@ -58,7 +58,7 @@ class Shell(dotbot.Plugin): success = False self._log.warning('Command [%s] failed' % cmd) if success: - self._log.info('All commands have been executed') + self._log.verbose('All commands have been executed') else: self._log.error('Some commands were not successfully executed') return success -- cgit v1.2.3