Misc logging cleanup + commentary #4293
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I played around with the logging module this morning from an end-user perspective. It was a lot of fun! There are some fixes we should definitely merge; some questions are open for discussion. I tried to keep the commits separate + clean, so we could split up and cherry-pick accordingly. This is all in the interest of making dbt look + feel "like dbt" by v1 final.
Critical fixes
create_json_log_line
andcreate_text_log_line
based onthis.format_json
Touch-ups + cosmetic fixes
\n
, instead precede them withfire_event(EmptyLine())
. This is much cleaner to look at, since all (non-wrapped) log lines get the same frontmatter (timestamp + log level)ConcurrencyLine
could be more structured (unless there's a good reason why it wasn't)WARNING
prefixes in messages / formatted viawarning_tag
Commentary
warn
/yellow +error
/red to raise the signal from the noise. (Also, I believe Minor Cleanup of Structured Logging Module #4266 removed width-fixing for log levels, so I added that back in.)dbt.ui.color
would need information from theevents
module, beyond justflags.USE_COLORS
. Since color methods are mostly called in messages defined on event classes, I wonder if this could work by adding ause_color(self) -> bool
method to theFile
+Cli
base types, and reimplementing the color methods to checkself.use_color
(where self = event class).logbook
accomplished via theTextOnly()
wrapper; I realize I was a bit inconsistent in whether I used this.)Broadly, I find that I want:
Checklist
CHANGELOG.md
and added information about my change