Skip to content
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

whitelist loggers instead of blacklisting nonexhaustively #663

Merged
merged 2 commits into from
Feb 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions dbt/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@

import colorama

# disable logs from other modules, excepting CRITICAL logs
logging.getLogger('botocore').setLevel(logging.CRITICAL)
logging.getLogger('contracts').setLevel(logging.CRITICAL)
logging.getLogger('requests').setLevel(logging.CRITICAL)
logging.getLogger('urllib3').setLevel(logging.CRITICAL)
logging.getLogger('google').setLevel(logging.CRITICAL)
logging.getLogger('snowflake.connector').setLevel(logging.CRITICAL)
logging.getLogger('parsedatetime').setLevel(logging.CRITICAL)

# Colorama needs some help on windows because we're using logger.info
# intead of print(). If the Windows env doesn't have a TERM var set,
Expand All @@ -36,9 +28,14 @@
stdout_handler.setFormatter(logging.Formatter('%(message)s'))
stdout_handler.setLevel(logging.INFO)

logger = logging.getLogger()
logger = logging.getLogger('dbt')
logger.addHandler(stdout_handler)
logger.setLevel(logging.DEBUG)
logging.getLogger().setLevel(logging.CRITICAL)

# Redirect warnings through our logging setup
# They will be logged to a file below
logging.captureWarnings(True)

initialized = False

Expand Down Expand Up @@ -90,6 +87,11 @@ def initialize_logger(debug_mode=False, path=None):

logger.addHandler(logdir_handler)

# Log Python warnings to file
warning_logger = logging.getLogger('py.warnings')
warning_logger.addHandler(logdir_handler)
warning_logger.setLevel(logging.DEBUG)

initialized = True


Expand Down
1 change: 0 additions & 1 deletion scripts/dbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ import dbt.main
import logging

if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
dbt.main.main(sys.argv[1:])