Mercurial > public > mercurial-scm > hg-stable
diff mercurial/ui.py @ 40794:ffd574c144d2
ui: pass in formatted message to logger.log()
This makes sure that all logger instances will handle the message arguments
properly.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 11 Nov 2018 19:35:33 +0900 |
parents | fdc6eb1d650d |
children | 691c68bc1222 |
line wrap: on
line diff
--- a/mercurial/ui.py Sun Nov 11 17:34:46 2018 +0900 +++ b/mercurial/ui.py Sun Nov 11 19:35:33 2018 +0900 @@ -1724,14 +1724,14 @@ """ self._loggers[name] = logger - def log(self, event, *msg, **opts): + def log(self, event, msgfmt, *msgargs, **opts): '''hook for logging facility extensions event should be a readily-identifiable subsystem, which will allow filtering. - *msg should be a newline-terminated format string to log, and - then any values to %-format into that format string. + msgfmt should be a newline-terminated format string to log, and + *msgargs are %-formatted into it. **opts currently has no defined meanings. ''' @@ -1741,6 +1741,7 @@ if l.tracked(event)] if not activeloggers: return + msg = msgfmt % msgargs # guard against recursion from e.g. ui.debug() registeredloggers = self._loggers self._loggers = {}