Show More
@@ -52,7 +52,6 b' from mercurial import (' | |||
|
52 | 52 | encoding, |
|
53 | 53 | pycompat, |
|
54 | 54 | registrar, |
|
55 | ui as uimod, | |
|
56 | 55 | ) |
|
57 | 56 | from mercurial.utils import ( |
|
58 | 57 | dateutil, |
@@ -129,7 +128,6 b' def _openlogfile(ui, vfs):' | |||
|
129 | 128 | class blackboxlogger(object): |
|
130 | 129 | def __init__(self, ui): |
|
131 | 130 | self._repo = None |
|
132 | self._inlog = False | |
|
133 | 131 | self._trackedevents = set(ui.configlist('blackbox', 'track')) |
|
134 | 132 | |
|
135 | 133 | @property |
@@ -158,10 +156,6 b' class blackboxlogger(object):' | |||
|
158 | 156 | _lastlogger._log(ui, event, msg, opts) |
|
159 | 157 | |
|
160 | 158 | def _log(self, ui, event, msg, opts): |
|
161 | if self._inlog: | |
|
162 | # recursion guard | |
|
163 | return | |
|
164 | self._inlog = True | |
|
165 | 159 | default = ui.configdate('devel', 'default-date') |
|
166 | 160 | date = dateutil.datestr(default, ui.config('blackbox', 'date-format')) |
|
167 | 161 | user = procutil.getuser() |
@@ -189,25 +183,10 b' class blackboxlogger(object):' | |||
|
189 | 183 | self._repo = None |
|
190 | 184 | ui.debug('warning: cannot write to blackbox.log: %s\n' % |
|
191 | 185 | encoding.strtolocal(err.strerror)) |
|
192 | else: | |
|
193 | self._inlog = False | |
|
194 | 186 | |
|
195 | 187 | def setrepo(self, repo): |
|
196 | 188 | self._repo = repo |
|
197 | 189 | |
|
198 | def wrapui(ui): | |
|
199 | class blackboxui(ui.__class__): | |
|
200 | def debug(self, *msg, **opts): | |
|
201 | super(blackboxui, self).debug(*msg, **opts) | |
|
202 | if self.debugflag: | |
|
203 | self.log('debug', '%s', ''.join(msg)) | |
|
204 | ||
|
205 | ui.__class__ = blackboxui | |
|
206 | uimod.ui = blackboxui | |
|
207 | ||
|
208 | def uisetup(ui): | |
|
209 | wrapui(ui) | |
|
210 | ||
|
211 | 190 | def uipopulate(ui): |
|
212 | 191 | ui.setlogger(b'blackbox', blackboxlogger(ui)) |
|
213 | 192 |
@@ -1521,6 +1521,7 b' class ui(object):' | |||
|
1521 | 1521 | ''' |
|
1522 | 1522 | if self.debugflag: |
|
1523 | 1523 | self._writemsg(self._fmsgout, type='debug', *msg, **opts) |
|
1524 | self.log(b'debug', b'%s', b''.join(msg)) | |
|
1524 | 1525 | |
|
1525 | 1526 | def edit(self, text, user, extra=None, editform=None, pending=None, |
|
1526 | 1527 | repopath=None, action=None): |
@@ -1740,8 +1741,14 b' class ui(object):' | |||
|
1740 | 1741 | if l.tracked(event)] |
|
1741 | 1742 | if not activeloggers: |
|
1742 | 1743 | return |
|
1744 | # guard against recursion from e.g. ui.debug() | |
|
1745 | registeredloggers = self._loggers | |
|
1746 | self._loggers = {} | |
|
1747 | try: | |
|
1743 | 1748 | for logger in activeloggers: |
|
1744 | 1749 | logger.log(self, event, msg, opts) |
|
1750 | finally: | |
|
1751 | self._loggers = registeredloggers | |
|
1745 | 1752 | |
|
1746 | 1753 | def label(self, msg, label): |
|
1747 | 1754 | '''style msg based on supplied label |
General Comments 0
You need to be logged in to leave comments.
Login now