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
|
raise LoggerError("Unable to log without an active app.") from None
|
||||||
if not app.devtools.is_connected:
|
if not app.devtools.is_connected:
|
||||||
return
|
return
|
||||||
caller = inspect.stack(0)[1]
|
|
||||||
|
previous_frame = inspect.currentframe().f_back
|
||||||
|
caller = inspect.getframeinfo(previous_frame)
|
||||||
|
|
||||||
_log = self._log or app._log
|
_log = self._log or app._log
|
||||||
try:
|
try:
|
||||||
_log(
|
_log(
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ class StdoutRedirector:
|
|||||||
if not self.devtools.is_connected:
|
if not self.devtools.is_connected:
|
||||||
return
|
return
|
||||||
|
|
||||||
caller = inspect.stack(0)[1]
|
previous_frame = inspect.currentframe().f_back
|
||||||
|
caller = inspect.getframeinfo(previous_frame)
|
||||||
|
|
||||||
self._buffer.append(DevtoolsLog(string, caller=caller))
|
self._buffer.append(DevtoolsLog(string, caller=caller))
|
||||||
|
|
||||||
# By default, `print` adds a "\n" suffix which results in a buffer
|
# By default, `print` adds a "\n" suffix which results in a buffer
|
||||||
|
|||||||
Reference in New Issue
Block a user