Skip to content

Commit

Permalink
Merge pull request #70 from BorjaEst/simple_log_examples
Browse files Browse the repository at this point in the history
Simple log examples
  • Loading branch information
dianagudu authored Aug 19, 2022
2 parents fd9916e + 512ba58 commit 1169320
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 27 deletions.
11 changes: 7 additions & 4 deletions examples/example_aio.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
from aiohttp import web
import logging

from examples.logsetup import setup_logging
from aiohttp import web
from flaat import AuthWorkflow
from flaat.aio import Flaat
from flaat.exceptions import FlaatException
from flaat.requirements import CheckResult, get_claim_requirement, get_vo_requirement
from flaat.requirements import CheckResult
from flaat.requirements import get_claim_requirement
from flaat.requirements import get_vo_requirement
from flaat.user_infos import UserInfos

# do some log setup so we can see something
setup_logging()
logging.basicConfig(level="WARNING")
logging.getLogger("flaat").setLevel("DEBUG")


##########
Expand Down
6 changes: 4 additions & 2 deletions examples/example_fastapi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Flaat example with FastAPI
import logging
from fastapi import Depends, FastAPI, Request, Response
from fastapi.security import HTTPBasicCredentials, HTTPBearer
from flaat import AuthWorkflow
Expand All @@ -8,11 +9,12 @@
from flaat.requirements import get_claim_requirement
from flaat.requirements import get_vo_requirement

from examples import logsetup

# ------------------------------------------------------------------
# Basic configuration example ---------------------------------------
logger = logsetup.setup_logging()
logging.basicConfig(level="WARNING")
logging.getLogger("flaat").setLevel("DEBUG")
logging.getLogger("urllib3").setLevel("DEBUG")
ADMIN_EMAILS = ["[email protected]", "[email protected]"]


Expand Down
6 changes: 4 additions & 2 deletions examples/example_flask.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Flaat example with Flask
import logging
from flaat import AuthWorkflow
from flaat.config import AccessLevel
from flaat.flask import Flaat
Expand All @@ -9,11 +10,12 @@
from flask import Blueprint, Flask, abort, current_app
from werkzeug import Response

from examples import logsetup

# ------------------------------------------------------------------
# Basic configuration example ---------------------------------------
logger = logsetup.setup_logging()
logging.basicConfig(level="WARNING")
logging.getLogger("flaat").setLevel("DEBUG")
logging.getLogger("werkzeug").setLevel("DEBUG")

# Standard flask blueprint snippet, source:
# https://flask.palletsprojects.com/en/2.1.x/blueprints
Expand Down
19 changes: 0 additions & 19 deletions examples/logsetup.py

This file was deleted.

0 comments on commit 1169320

Please sign in to comment.