Skip to content

Commit

Permalink
fix: don't use structlog private fields
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-makerx committed Jan 8, 2024
1 parent 14aecde commit 831bd68
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/puya/logging_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,15 @@ def mypy_severity_to_loglevel(severity: str) -> int:


class PuyaConsoleRender(structlog.dev.ConsoleRenderer):
def __init__(self, *args: typing.Any, **kwargs: typing.Any):
super().__init__(*args, **kwargs)
def __init__(self, *, colors: bool):
super().__init__(colors=colors)
self.level_to_color = self.get_default_level_styles(colors)
self.base_path = str(Path.cwd()) # TODO: don't assume this?
if not self.base_path.endswith(
os.path.sep
): # TODO: can we always append the path seperator?
self.base_path += os.path.sep

level_color_map = self._level_to_color
assert isinstance(level_color_map, dict)
self.level_to_color = level_color_map

def _location_as_link(self, location: SourceLocation | None) -> str:
if not location or not location.file:
return ""
Expand Down Expand Up @@ -101,7 +98,7 @@ def __call__(
sio.write(self._styles.reset)

# force event to str for compatibility with standard library
event = event_dict.pop(self._event_key, None)
event = event_dict.pop("event", None)
if not isinstance(event, str):
event = str(event)

Expand Down

0 comments on commit 831bd68

Please sign in to comment.