Use a name less likely to conflict

This commit is contained in:
Darren Burns
2022-04-12 15:05:26 +01:00
parent c038b02c39
commit 7e15822bf9
3 changed files with 7 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ def log(*args: object, verbosity: int = 0, **kwargs) -> None:
app = active_app.get()
caller = inspect.stack()[1]
app.log(*args, verbosity=verbosity, caller=caller, **kwargs)
app.log(*args, verbosity=verbosity, _textual_calling_frame=caller, **kwargs)
def panic(*args: RenderableType) -> None:

View File

@@ -208,7 +208,7 @@ class App(DOMNode):
self,
*objects: Any,
verbosity: int = 1,
caller: inspect.FrameInfo | None = None,
_textual_calling_frame: inspect.FrameInfo | None = None,
**kwargs,
) -> None:
"""Write to logs.
@@ -224,11 +224,11 @@ class App(DOMNode):
key_values = " ".join(f"{key}={value}" for key, value in kwargs.items())
output = " ".join((output, key_values))
if not caller:
caller = inspect.stack()[1]
if not _textual_calling_frame:
_textual_calling_frame = inspect.stack()[1]
calling_path = caller.filename
calling_lineno = caller.lineno
calling_path = _textual_calling_frame.filename
calling_lineno = _textual_calling_frame.lineno
if self.devtools.is_connected and verbosity <= self.log_verbosity:
if len(objects) > 1 or len(kwargs) >= 1 and output:

View File

@@ -87,7 +87,7 @@ class MessagePump:
return self._running
def log(self, *args, **kwargs) -> None:
return self.app.log(*args, **kwargs, caller=inspect.stack()[1])
return self.app.log(*args, **kwargs, _textual_calling_frame=inspect.stack()[1])
def set_parent(self, parent: MessagePump) -> None:
self._parent = parent