Better complete debug function

This commit is contained in:
Kovid Goyal 2021-07-11 21:33:19 +05:30
parent 1d9626d493
commit 6945eb4186
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -79,8 +79,12 @@ def values(self) -> Iterator[str]:
def debug(*a: Any, **kw: Any) -> None:
kw['file'] = sys.stderr
print(*a, **kw)
from kittens.tui.loop import Debug
if not hasattr(debug, 'output'):
d = Debug()
d.fobj = sys.stderr.buffer # type: ignore
setattr(debug, 'output', d)
getattr(debug, 'output')(*a, **kw)
class Delegate: