Skip to content

Commit

Permalink
Minor Cleanup of Structured Logging Module (#4266)
Browse files Browse the repository at this point in the history
* cleanup structured logging module

* update adapter logger to preserve new-style logging formatting

automatic commit by git-black, original commits:
  719b202
  • Loading branch information
Nathaniel May authored and iknox-fa committed Feb 8, 2022
1 parent d4d0897 commit b342598
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/dbt/events/base_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Cache:


@dataclass
class ShowException():
class ShowException:
# N.B.:
# As long as we stick with the current convention of setting the member vars in the
# `message` method of subclasses, this is a safe operation.
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/events/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def event_to_serializable_dict(
# translates an Event to a completely formatted text-based log line
# type hinting everything as strings so we don't get any unintentional string conversions via str()
def create_info_text_log_line(e: T_Event) -> str:
color_tag: str = '' if this.format_color else Style.RESET_ALL
color_tag: str = "" if this.format_color else Style.RESET_ALL
ts: str = get_ts().strftime("%H:%M:%S")
scrubbed_msg: str = scrub_secrets(e.message(), env_secrets())
log_line: str = f"{color_tag}{ts} {scrubbed_msg}"
Expand Down
4 changes: 2 additions & 2 deletions core/dbt/events/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def level_tag(self) -> str:

def message(self) -> str:
# this class shouldn't be createable, but we can't make it an ABC because of a mypy bug
if type(self).__name__ == 'AdapterEventBase':
if type(self).__name__ == "AdapterEventBase":
raise Exception(
'attempted to create a message for AdapterEventBase which cannot be created'
"attempted to create a message for AdapterEventBase which cannot be created"
)

# only apply formatting if there are arguments to format.
Expand Down

0 comments on commit b342598

Please sign in to comment.