mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Issue #20045: Fix "setup.py register --list-classifiers".
This commit is contained in:
parent
492b9893e1
commit
716b7222e9
4 changed files with 27 additions and 6 deletions
|
@ -32,14 +32,15 @@ class LoggingSilencer(object):
|
|||
def _log(self, level, msg, args):
|
||||
if level not in (DEBUG, INFO, WARN, ERROR, FATAL):
|
||||
raise ValueError('%s wrong log level' % str(level))
|
||||
if not isinstance(msg, str):
|
||||
raise TypeError("msg should be str, not '%.200s'"
|
||||
% (type(msg).__name__))
|
||||
self.logs.append((level, msg, args))
|
||||
|
||||
def get_logs(self, *levels):
|
||||
def _format(msg, args):
|
||||
if len(args) == 0:
|
||||
return msg
|
||||
return msg % args
|
||||
return [_format(msg, args) for level, msg, args
|
||||
return [msg % args for level, msg, args
|
||||
in self.logs if level in levels]
|
||||
|
||||
def clear_logs(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue