##// END OF EJS Templates
blackbox: initialize logger with repo instance...
Yuya Nishihara -
r40797:567e164f default
parent child Browse files
Show More
@@ -139,17 +139,15 b' class proxylogger(object):'
139 _lastlogger = proxylogger()
139 _lastlogger = proxylogger()
140
140
141 class blackboxlogger(object):
141 class blackboxlogger(object):
142 def __init__(self, ui):
142 def __init__(self, ui, repo):
143 self._repo = None
143 self._repo = repo
144 self._trackedevents = set(ui.configlist('blackbox', 'track'))
144 self._trackedevents = set(ui.configlist('blackbox', 'track'))
145
145
146 @property
146 @property
147 def _bbvfs(self):
147 def _bbvfs(self):
148 vfs = None
148 vfs = self._repo.vfs
149 if self._repo:
149 if not vfs.isdir('.'):
150 vfs = self._repo.vfs
150 vfs = None
151 if not vfs.isdir('.'):
152 vfs = None
153 return vfs
151 return vfs
154
152
155 def tracked(self, event):
153 def tracked(self, event):
@@ -188,9 +186,6 b' class blackboxlogger(object):'
188 ui.debug('warning: cannot write to blackbox.log: %s\n' %
186 ui.debug('warning: cannot write to blackbox.log: %s\n' %
189 encoding.strtolocal(err.strerror))
187 encoding.strtolocal(err.strerror))
190
188
191 def setrepo(self, repo):
192 self._repo = repo
193
194 def uipopulate(ui):
189 def uipopulate(ui):
195 ui.setlogger(b'blackbox', _lastlogger)
190 ui.setlogger(b'blackbox', _lastlogger)
196
191
@@ -203,9 +198,8 b' def reposetup(ui, repo):'
203
198
204 # Since blackbox.log is stored in the repo directory, the logger should be
199 # Since blackbox.log is stored in the repo directory, the logger should be
205 # instantiated per repository.
200 # instantiated per repository.
206 logger = blackboxlogger(ui)
201 logger = blackboxlogger(ui, repo)
207 ui.setlogger(b'blackbox', logger)
202 ui.setlogger(b'blackbox', logger)
208 logger.setrepo(repo)
209
203
210 # Set _lastlogger even if ui.log is not called. This gives blackbox a
204 # Set _lastlogger even if ui.log is not called. This gives blackbox a
211 # fallback place to log
205 # fallback place to log
General Comments 0
You need to be logged in to leave comments. Login now