Skip to content

Commit

Permalink
Merge pull request #483 from mozilla-iam/gcp_logging
Browse files Browse the repository at this point in the history
Gcp logging
  • Loading branch information
dividehex authored Oct 19, 2023
2 parents 54d71db + 8cc561d commit 5c2a63e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
8 changes: 1 addition & 7 deletions dashboard/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""SSO Dashboard App File."""
import google.cloud.logging
import json
import logging.config
import mimetypes
Expand Down Expand Up @@ -39,20 +38,15 @@
from dashboard.models.alert import Rules
from dashboard.models.tile import S3Transfer

from google.cloud.logging_v2.handlers import CloudLoggingHandler

logging.basicConfig(level=logging.DEBUG)
logging.basicConfig(level=logging.INFO)

with open("dashboard/logging.yml", "r") as log_config:
config_yml = log_config.read()
config_dict = yaml.safe_load(config_yml)
logging.config.dictConfig(config_dict)

gcp_logger_client = google.cloud.logging.Client()
gcp_handler = CloudLoggingHandler(gcp_logger_client)

logger = logging.getLogger("sso-dashboard")
logger.addHandler(gcp_handler)

app = Flask(__name__)
everett_config = get_config()
Expand Down
1 change: 1 addition & 0 deletions dashboard/logging.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Default AWS Config
version: 1
disable_existing_loggers: False
formatters:
json:
format: "[%(asctime)s] %(process)d %(levelname)s %(name)s:%(funcName)s:%(lineno)s - %(message)s"
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Flask-pyoidc==3.13.0
flask-talisman==1.0.0
future==0.18.3
gevent==22.10.2
google-cloud-logging>=3.0.0
greenlet==2.0.2
gunicorn==20.1.0
identify==2.5.24
Expand Down

0 comments on commit 5c2a63e

Please sign in to comment.