mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
faster than inspect
This commit is contained in:
@@ -54,7 +54,10 @@ class Logger:
|
||||
raise LoggerError("Unable to log without an active app.") from None
|
||||
if not app.devtools.is_connected:
|
||||
return
|
||||
caller = inspect.stack(0)[1]
|
||||
|
||||
previous_frame = inspect.currentframe().f_back
|
||||
caller = inspect.getframeinfo(previous_frame)
|
||||
|
||||
_log = self._log or app._log
|
||||
try:
|
||||
_log(
|
||||
|
||||
@@ -39,7 +39,9 @@ class StdoutRedirector:
|
||||
if not self.devtools.is_connected:
|
||||
return
|
||||
|
||||
caller = inspect.stack(0)[1]
|
||||
previous_frame = inspect.currentframe().f_back
|
||||
caller = inspect.getframeinfo(previous_frame)
|
||||
|
||||
self._buffer.append(DevtoolsLog(string, caller=caller))
|
||||
|
||||
# By default, `print` adds a "\n" suffix which results in a buffer
|
||||
|
||||
Reference in New Issue
Block a user