diff options
author | W. Trevor King <wking@tremily.us> | 2013-01-24 02:31:52 -0500 |
---|---|---|
committer | W. Trevor King <wking@tremily.us> | 2013-01-24 02:36:22 -0500 |
commit | 932679f1e82a57feb4743e52d6c60f7331f057c2 (patch) | |
tree | 21c014cf36c8c159b7e5bf4627abf94b2e7a371b /libbe/storage/vcs/base.py | |
parent | 182a556397c2b0f4638991942c736c5daff17111 (diff) | |
download | bugseverywhere-932679f1e82a57feb4743e52d6c60f7331f057c2.tar.gz |
Transition to libbe.LOG for logging
This makes it easier to tweak log verbosity and redirect logs to other
handlers. For example, the WSGI servers are unstable with stderr
closed, and crash with an IOError if they try to print a warning to
stderr.
Diffstat (limited to 'libbe/storage/vcs/base.py')
-rw-r--r-- | libbe/storage/vcs/base.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libbe/storage/vcs/base.py b/libbe/storage/vcs/base.py index 845336d..671df43 100644 --- a/libbe/storage/vcs/base.py +++ b/libbe/storage/vcs/base.py @@ -207,7 +207,7 @@ class CachedPathID (object): self._cache_path = os.path.join( self._root, self._spacer_dirs[0], 'id-cache') - def init(self, verbose=True, cache=None): + def init(self, cache=None): """Create cache file for an existing .be directory. The file contains multiple lines of the form:: @@ -227,8 +227,10 @@ class CachedPathID (object): id = self.id(dirpath) relpath = dirpath[len(self._root + os.path.sep):] if id.count('/') == 0: - if verbose == True and id in self._cache: - print >> sys.stderr, 'Multiple paths for %s: \n %s\n %s' % (id, self._cache[id], relpath) + if id in self._cache: + libbe.LOG.warning( + 'multiple paths for {0}:\n {1}\n {2}'.format( + id, self._cache[id], relpath)) self._cache[id] = relpath except InvalidPath: pass @@ -271,7 +273,7 @@ class CachedPathID (object): else: extra = fields[1:] if uuid not in self._cache: - self.init(verbose=False, cache=self._cache) + self.init(cache=self._cache) if uuid not in self._cache: raise InvalidID(uuid) if relpath == True: @@ -355,7 +357,6 @@ class VCS (libbe.storage.base.VersionedStorage): libbe.storage.base.VersionedStorage.__init__(self, *args, **kwargs) self.versioned = False self.interspersed_vcs_files = False - self.verbose_invoke = False self._cached_path_id = CachedPathID() self._rooted = False @@ -923,8 +924,6 @@ class VCS (libbe.storage.base.VersionedStorage): def _u_invoke(self, *args, **kwargs): if 'cwd' not in kwargs: kwargs['cwd'] = self.repo - if 'verbose' not in kwargs: - kwargs['verbose'] = self.verbose_invoke if 'encoding' not in kwargs: kwargs['encoding'] = self.encoding return invoke(*args, **kwargs) |