*(minor): stdlib logging to structlog

This commit is contained in:
Langhammer, Jens
2019-10-01 10:24:10 +02:00
parent b3aede5bba
commit f4499a5459
56 changed files with 111 additions and 259 deletions

View File

@ -1,12 +1,12 @@
"""passbook oauth_client config"""
from importlib import import_module
from logging import getLogger
from django.apps import AppConfig
from structlog import get_logger
from passbook.lib.config import CONFIG
LOGGER = getLogger(__name__)
LOGGER = get_logger(__name__)
class PassbookOAuthClientConfig(AppConfig):
"""passbook oauth_client config"""

View File

@ -1,7 +1,6 @@
"""OAuth Clients"""
import json
from logging import getLogger
from urllib.parse import parse_qs, urlencode
from django.conf import settings
@ -10,8 +9,9 @@ from django.utils.encoding import force_text
from requests import Session
from requests.exceptions import RequestException
from requests_oauthlib import OAuth1
from structlog import get_logger
LOGGER = getLogger(__name__)
LOGGER = get_logger(__name__)
class BaseOAuthClient:

View File

@ -1,16 +1,16 @@
"""AzureAD OAuth2 Views"""
import json
import uuid
from logging import getLogger
from requests.exceptions import RequestException
from structlog import get_logger
from passbook.oauth_client.clients import OAuth2Client
from passbook.oauth_client.source_types.manager import MANAGER, RequestKind
from passbook.oauth_client.utils import user_get_or_create
from passbook.oauth_client.views.core import OAuthCallback
LOGGER = getLogger(__name__)
LOGGER = get_logger(__name__)
class AzureADOAuth2Client(OAuth2Client):

View File

@ -1,15 +1,15 @@
"""Discord OAuth Views"""
import json
from logging import getLogger
from requests.exceptions import RequestException
from structlog import get_logger
from passbook.oauth_client.clients import OAuth2Client
from passbook.oauth_client.source_types.manager import MANAGER, RequestKind
from passbook.oauth_client.utils import user_get_or_create
from passbook.oauth_client.views.core import OAuthCallback, OAuthRedirect
LOGGER = getLogger(__name__)
LOGGER = get_logger(__name__)
@MANAGER.source(kind=RequestKind.redirect, name='Discord')

View File

@ -1,10 +1,11 @@
"""Source type manager"""
from enum import Enum
from logging import getLogger
from structlog import get_logger
from passbook.oauth_client.views.core import OAuthCallback, OAuthRedirect
LOGGER = getLogger(__name__)
LOGGER = get_logger(__name__)
class RequestKind(Enum):
"""Enum of OAuth Request types"""

View File

@ -1,16 +1,16 @@
"""Reddit OAuth Views"""
import json
from logging import getLogger
from requests.auth import HTTPBasicAuth
from requests.exceptions import RequestException
from structlog import get_logger
from passbook.oauth_client.clients import OAuth2Client
from passbook.oauth_client.source_types.manager import MANAGER, RequestKind
from passbook.oauth_client.utils import user_get_or_create
from passbook.oauth_client.views.core import OAuthCallback, OAuthRedirect
LOGGER = getLogger(__name__)
LOGGER = get_logger(__name__)
@MANAGER.source(kind=RequestKind.redirect, name='reddit')

View File

@ -1,16 +1,16 @@
"""Supervisr OAuth2 Views"""
import json
from logging import getLogger
from requests.exceptions import RequestException
from structlog import get_logger
from passbook.oauth_client.clients import OAuth2Client
from passbook.oauth_client.source_types.manager import MANAGER, RequestKind
from passbook.oauth_client.utils import user_get_or_create
from passbook.oauth_client.views.core import OAuthCallback
LOGGER = getLogger(__name__)
LOGGER = get_logger(__name__)
class SupervisrOAuth2Client(OAuth2Client):

View File

@ -1,15 +1,14 @@
"""Twitter OAuth Views"""
from logging import getLogger
from requests.exceptions import RequestException
from structlog import get_logger
from passbook.oauth_client.clients import OAuthClient
from passbook.oauth_client.source_types.manager import MANAGER, RequestKind
from passbook.oauth_client.utils import user_get_or_create
from passbook.oauth_client.views.core import OAuthCallback
LOGGER = getLogger(__name__)
LOGGER = get_logger(__name__)
class TwitterOAuthClient(OAuthClient):

View File

@ -1,7 +1,5 @@
"""Core OAauth Views"""
from logging import getLogger
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import authenticate
@ -11,13 +9,14 @@ from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.views.generic import RedirectView, View
from structlog import get_logger
from passbook.core.auth.view import AuthenticationView, _redirect_with_qs
from passbook.lib.utils.reflection import app
from passbook.oauth_client.clients import get_client
from passbook.oauth_client.models import OAuthSource, UserOAuthSourceConnection
LOGGER = getLogger(__name__)
LOGGER = get_logger(__name__)
# pylint: disable=too-few-public-methods