Skip to content

Commit

Permalink
PR feedback, annotate hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Nov 29, 2021
1 parent 6cece1c commit 5508fa2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions core/dbt/task/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
InternalException
)
from dbt.logger import log_manager
import logging
import dbt.events.functions as event_logger
from dbt.events.functions import fire_event
from dbt.events.types import (
Expand Down Expand Up @@ -63,6 +64,9 @@ def __init__(self, args, config):
@classmethod
def pre_init_hook(cls, args):
"""A hook called before the task is initialized."""
# the event logger has been initialized, but it has not yet been configured
# TODO refactor
event_logger.STDOUT_LOG.level = logging.DEBUG if args.debug else logging.INFO
if args.log_format == 'json':
log_manager.format_json()
event_logger.format_json = True
Expand All @@ -71,6 +75,9 @@ def pre_init_hook(cls, args):

@classmethod
def set_log_format(cls):
# the event logger has been initialized, but it has not yet been configured
# TODO refactor
event_logger.STDOUT_LOG.level = logging.DEBUG if flags.DEBUG else logging.INFO
if flags.LOG_FORMAT == 'json':
log_manager.format_json()
event_logger.format_json = True
Expand Down
9 changes: 7 additions & 2 deletions core/dbt/task/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ def __init__(self, args, config):
@classmethod
def pre_init_hook(cls, args):
"""A hook called before the task is initialized."""
log_manager.stderr_console()
event_logger.STDOUT_LOG.level = logging.WARN
super().pre_init_hook(args)
log_manager.stderr_console()
# filter out all INFO-level logging to allow piping ls output to jq, etc
# WARN level will still include all warnings + errors
# if user has specified DEBUG level (dbt --debug), don't override
# TODO refactor!
if event_logger.STDOUT_LOG.level == logging.INFO:
event_logger.STDOUT_LOG.level = logging.WARN

def _iterate_selected_nodes(self):
selector = self.get_node_selector()
Expand Down

0 comments on commit 5508fa2

Please sign in to comment.