summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-11-15 15:07:30 +0100
committerAnton Khirnov <anton@khirnov.net>2020-11-15 15:07:30 +0100
commit4d5c7f992a7015f6c5e6d0051057120b8f0c382a (patch)
tree4ba2455c631ad9ca1db1c07bd58cd89be35ba2f7
parent5294594f5aa9c3affd0d656ba6843c1c0b0bce60 (diff)
messenger: rename lowinfo to verbose
This is more standard terminology.
-rw-r--r--dotbot/messenger/level.py2
-rw-r--r--dotbot/messenger/messenger.py14
-rw-r--r--dotbot/plugins/clean.py4
-rw-r--r--dotbot/plugins/create.py4
-rw-r--r--dotbot/plugins/link.py12
-rw-r--r--dotbot/plugins/shell.py6
6 files changed, 22 insertions, 20 deletions
diff --git a/dotbot/messenger/level.py b/dotbot/messenger/level.py
index 2c361f6..1efe86b 100644
--- a/dotbot/messenger/level.py
+++ b/dotbot/messenger/level.py
@@ -1,7 +1,7 @@
class Level(object):
NOTSET = 0
DEBUG = 10
- LOWINFO = 15
+ VERBOSE = 15
INFO = 20
WARNING = 30
ERROR = 40
diff --git a/dotbot/messenger/messenger.py b/dotbot/messenger/messenger.py
index 8fc650c..ee2d97f 100644
--- a/dotbot/messenger/messenger.py
+++ b/dotbot/messenger/messenger.py
@@ -3,8 +3,10 @@ from ..util.compat import with_metaclass
from .color import Color
from .level import Level
+import sys
+
class Messenger(with_metaclass(Singleton, object)):
- def __init__(self, level = Level.LOWINFO):
+ def __init__(self, level = Level.VERBOSE):
self.set_level(level)
self.use_color(True)
@@ -16,13 +18,13 @@ class Messenger(with_metaclass(Singleton, object)):
def log(self, level, message):
if (level >= self._level):
- print('%s%s%s' % (self._color(level), message, self._reset()))
+ sys.stderr.write('%s%s%s\n' % (self._color(level), message, self._reset()))
def debug(self, message):
self.log(Level.DEBUG, message)
- def lowinfo(self, message):
- self.log(Level.LOWINFO, message)
+ def verbose(self, message):
+ self.log(Level.VERBOSE, message)
def info(self, message):
self.log(Level.INFO, message)
@@ -41,9 +43,9 @@ class Messenger(with_metaclass(Singleton, object)):
return ''
elif level < Level.DEBUG:
return ''
- elif Level.DEBUG <= level < Level.LOWINFO:
+ elif Level.DEBUG <= level < Level.VERBOSE:
return Color.YELLOW
- elif Level.LOWINFO <= level < Level.INFO:
+ elif Level.VERBOSE <= level < Level.INFO:
return Color.BLUE
elif Level.INFO <= level < Level.WARNING:
return Color.GREEN
diff --git a/dotbot/plugins/clean.py b/dotbot/plugins/clean.py
index 09b11d8..c2793e5 100644
--- a/dotbot/plugins/clean.py
+++ b/dotbot/plugins/clean.py
@@ -51,10 +51,10 @@ 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.lowinfo('Removing invalid link %s -> %s' % (path, points_at))
+ self._log.verbose('Removing invalid link %s -> %s' % (path, points_at))
os.remove(path)
else:
- self._log.lowinfo('Link %s -> %s not removed.' % (path, points_at))
+ self._log.verbose('Link %s -> %s not removed.' % (path, points_at))
return True
def _in_directory(self, path, directory):
diff --git a/dotbot/plugins/create.py b/dotbot/plugins/create.py
index 015645a..eee6e17 100644
--- a/dotbot/plugins/create.py
+++ b/dotbot/plugins/create.py
@@ -40,11 +40,11 @@ class Create(dotbot.Plugin):
if not self._exists(path):
self._log.debug('Trying to create path %s' % path)
try:
- self._log.lowinfo('Creating path %s' % path)
+ self._log.verbose('Creating path %s' % path)
os.makedirs(path)
except OSError:
self._log.warning('Failed to create path %s' % path)
success = False
else:
- self._log.lowinfo('Path exists %s' % path)
+ self._log.verbose('Path exists %s' % path)
return success
diff --git a/dotbot/plugins/link.py b/dotbot/plugins/link.py
index 6f2b562..45b893f 100644
--- a/dotbot/plugins/link.py
+++ b/dotbot/plugins/link.py
@@ -48,7 +48,7 @@ class Link(dotbot.Plugin):
else:
path = self._default_source(destination, source)
if test is not None and not self._test_success(test):
- self._log.lowinfo('Skipping %s' % destination)
+ self._log.verbose('Skipping %s' % destination)
continue
path = os.path.expandvars(os.path.expanduser(path))
if use_glob:
@@ -74,7 +74,7 @@ class Link(dotbot.Plugin):
success &= self._delete(path, destination, relative, canonical_path, force)
success &= self._link(path, destination, relative, canonical_path, ignore_missing)
else:
- self._log.lowinfo("Globs from '" + path + "': " + str(glob_results))
+ self._log.verbose("Globs from '" + path + "': " + str(glob_results))
glob_base = path[:glob_star_loc]
for glob_full_item in glob_results:
glob_item = glob_full_item[len(glob_base):]
@@ -152,7 +152,7 @@ class Link(dotbot.Plugin):
self._log.warning('Failed to create directory %s' % parent)
success = False
else:
- self._log.lowinfo('Creating directory %s' % parent)
+ self._log.verbose('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.lowinfo('Removing %s' % path)
+ self._log.verbose('Removing %s' % path)
return success
def _relative_path(self, source, destination):
@@ -218,7 +218,7 @@ class Link(dotbot.Plugin):
except OSError:
self._log.warning('Linking failed %s -> %s' % (link_name, source))
else:
- self._log.lowinfo('Creating link %s -> %s' % (link_name, source))
+ self._log.verbose('Creating link %s -> %s' % (link_name, source))
success = True
elif self._exists(link_name) and not self._is_link(link_name):
self._log.warning(
@@ -236,6 +236,6 @@ class Link(dotbot.Plugin):
self._log.warning('Nonexistent source for %s : %s' %
(link_name, source))
else:
- self._log.lowinfo('Link exists %s -> %s' % (link_name, source))
+ self._log.verbose('Link exists %s -> %s' % (link_name, source))
success = True
return success
diff --git a/dotbot/plugins/shell.py b/dotbot/plugins/shell.py
index 3092f20..c1575ff 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.lowinfo(cmd)
+ self._log.verbose(cmd)
elif quiet:
- self._log.lowinfo('%s' % msg)
+ self._log.verbose('%s' % msg)
else:
- self._log.lowinfo('%s [%s]' % (msg, cmd))
+ self._log.verbose('%s [%s]' % (msg, cmd))
ret = dotbot.util.shell_command(
cmd,
cwd=self._context.base_directory(),