Skip to content

Commit

Permalink
pre commit
Browse files Browse the repository at this point in the history
  • Loading branch information
colinbowen committed Dec 2, 2024
1 parent 8ad0680 commit f33a062
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/logger_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
import json
import logging

from flask import has_request_context, request

Expand All @@ -15,10 +15,12 @@ def format(self, record):
}

if has_request_context():
log_record.update({
"remote_addr": request.remote_addr,
"url": request.url,
})
log_record.update(
{
"remote_addr": request.remote_addr,
"url": request.url,
}
)

return json.dumps(log_record)

Expand All @@ -36,7 +38,9 @@ def setup_logger(name, level, formatter):
def setup_logging(app):
"""Set up loggers for the app."""
audit_log_formatter = RequestFormatter()
app.audit_logger = setup_logger("audit_logger", logging.INFO, audit_log_formatter)
app.audit_logger = setup_logger(
"audit_logger", logging.INFO, audit_log_formatter
)

app_log_formatter = RequestFormatter()
app.app_logger = setup_logger("app_logger", logging.INFO, app_log_formatter)

0 comments on commit f33a062

Please sign in to comment.