Compare commits

...

2 Commits

Author SHA1 Message Date
Beverly Nguyen
d4a2584dfb update logging 2025-04-14 14:51:55 -07:00
Beverly Nguyen
638a4f20da update logging 2025-04-14 14:49:19 -07:00
3 changed files with 6 additions and 3 deletions

View File

@@ -50,7 +50,8 @@ def index():
counts = status_api_client.get_count_of_live_services_and_organizations()
except Exception as e:
logger.warning(f"API down when loading homepage: {e}")
counts = {"live_service_count": "N/A", "live_organization_count": "N/A"}
counts = None
print(counts)
return render_template(
"views/signedout.html",
sms_rate=CURRENT_SMS_RATE,

View File

@@ -8,7 +8,7 @@ import usaButton %} {% block meta %}
{% block beforeContent %}{% endblock %}
<main id="main-content" role="main">
{% if counts.live_service_count == 'N/A' %}
{% if counts %}
<div class="usa-alert usa-alert--info usa-alert--slim" aria-label="Site alert,,,,">
<div class="grid-container padding-x-0">
<div class="usa-alert__body">

View File

@@ -15,6 +15,7 @@ class ColorFormatter(logging.Formatter):
'DEBUG': '\033[94m',
'WARNING': '\033[93m',
'ERROR': '\033[91m',
'CRITICAL': '\033[95m',
}
RESET = '\033[0m'
@@ -93,7 +94,6 @@ def init_app(app):
def get_handlers(app):
handlers = []
color_formatter = ColorFormatter(LOG_FORMAT, TIME_FORMAT)
json_formatter = JSONFormatter(LOG_FORMAT, TIME_FORMAT)
stream_handler = logging.StreamHandler(sys.stdout)
@@ -106,6 +106,8 @@ def get_handlers(app):
return not ("GET /static/" in msg and " 200 " in msg)
logging.getLogger("werkzeug").addFilter(is_200_static_log)
color_formatter = ColorFormatter(LOG_FORMAT, TIME_FORMAT)
handlers.append(configure_handler(stream_handler, app, color_formatter))
return handlers