-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging: restore previous (small) behaviors #4341
Changes from all commits
1f9f98c
88dbe5d
6cece1c
5508fa2
1799721
d9bcf34
9695a05
291d680
afd8201
6f3bbce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -11,6 +11,8 @@ | |||||||||||
from dbt.node_types import NodeType | ||||||||||||
from dbt.exceptions import RuntimeException, InternalException, warn_or_error | ||||||||||||
from dbt.logger import log_manager | ||||||||||||
import logging | ||||||||||||
import dbt.events.functions as event_logger | ||||||||||||
|
||||||||||||
|
||||||||||||
class ListTask(GraphRunnableTask): | ||||||||||||
|
@@ -55,8 +57,17 @@ def __init__(self, args, config): | |||||||||||
@classmethod | ||||||||||||
def pre_init_hook(cls, args): | ||||||||||||
"""A hook called before the task is initialized.""" | ||||||||||||
# Filter out all INFO-level logging to allow piping ls output to jq, etc | ||||||||||||
# WARN level will still include all warnings + errors | ||||||||||||
# Do this by: | ||||||||||||
# - returning the log level so that we can pass it into the 'level_override' | ||||||||||||
# arg of events.functions.setup_event_logger() -- good! | ||||||||||||
# - mutating the initialized, not-yet-configured STDOUT event logger | ||||||||||||
# because it's being configured too late -- bad! TODO refactor! | ||||||||||||
log_manager.stderr_console() | ||||||||||||
event_logger.STDOUT_LOG.level = logging.WARN | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm definitely not a fan of reaching in and modifying There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, are there info-level logs we're trying to filter out? I'm not sure why we're setting it to warn here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes - the Lines 517 to 521 in f72b603
The way we've done this in the past is by setting the stdout logger level to |
||||||||||||
super().pre_init_hook(args) | ||||||||||||
return logging.WARN | ||||||||||||
|
||||||||||||
def _iterate_selected_nodes(self): | ||||||||||||
selector = self.get_node_selector() | ||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome! glad this works now 💪