Skip to content

Commit

Permalink
Squash 146 - Revert commits and clean up file
Browse files Browse the repository at this point in the history
  • Loading branch information
MackHalliday committed Jun 26, 2024
1 parent b0e6a8f commit f19453e
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions notifications_utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,11 @@ def init_app(app, statsd_client=None):
if app.config['NOTIFY_ENVIRONMENT'] == 'production':
app.config.setdefault('NOTIFY_LOG_LEVEL', 'INFO')
else:
app.config.setdefault('NOTIFY_LOG_LEVEL', 'INFO')
breakpoint()
# app.config.setdefault('NOTIFY_LOG_LEVEL', 'INFO')
app.config.setdefault('NOTIFY_LOG_LEVEL', 'DEBUG')

app.config.setdefault('NOTIFY_APP_NAME', 'none')
app.config.setdefault('NOTIFY_LOG_PATH', './log/application.log')

print("WHAT IS NOTIFY_LOG_LEVEL 1", app.config['NOTIFY_LOG_LEVEL'])

@app.after_request
def after_request(response):
extra_fields = {
Expand Down Expand Up @@ -89,15 +86,12 @@ def after_request(response):
ensure_log_path_exists(app.config['NOTIFY_LOG_PATH'])
the_handler = get_handler(app)

# Add to see log level while running local
loglevel = logging.getLevelName(app.config['NOTIFY_LOG_LEVEL'])
print("WHAT IS NOTIFY_LOG_LEVEL 2", app.config['NOTIFY_LOG_LEVEL'])

loggers = [app.logger, logging.getLogger('utils')]
for the_logger, handler in product(loggers, [the_handler]):
the_logger.addHandler(handler)
the_logger.setLevel(loglevel)
print("WHAT IS LOG LEVEL FOR the_logger", the_logger.level)

logging.getLogger('boto3').setLevel(logging.WARNING)
logging.getLogger('s3transfer').setLevel(logging.WARNING)
Expand Down Expand Up @@ -130,8 +124,6 @@ def get_handler(app):
stream_handler.addFilter(AppNameFilter(app.config['NOTIFY_APP_NAME']))
stream_handler.addFilter(RequestIdFilter())

print("WHAT IS THE stream_handler", stream_handler.__dict__)

if app.debug:
# Human readable stdout logs that omit static route 200 responses
logging.getLogger('werkzeug').addFilter(is_200_static_log)
Expand Down

0 comments on commit f19453e

Please sign in to comment.