Add a global debug function to the kittens

This commit is contained in:
Kovid Goyal
2018-05-06 13:48:40 +05:30
parent 5b58c2892d
commit d61086907d
2 changed files with 13 additions and 3 deletions

View File

@@ -28,10 +28,10 @@ from .handler import Handler
from .operations import clear_screen, init_state, reset_state
def log(*a, **kw):
fd = getattr(log, 'fd', None)
def debug(*a, **kw):
fd = getattr(debug, 'fd', None)
if fd is None:
fd = log.fd = open('/tmp/kitten-debug', 'w')
fd = debug.fd = open('/tmp/kitten-debug', 'w')
kw['file'] = fd
print(*a, **kw)
fd.flush()