summaryrefslogtreecommitdiff
path: root/oauthlib/oauth2
diff options
context:
space:
mode:
authorIb Lundgren <ib.lundgren@gmail.com>2014-09-24 14:52:53 +0100
committerIb Lundgren <ib.lundgren@gmail.com>2014-09-24 14:52:53 +0100
commitedab385f951e38d65a25003f193793b63037bdec (patch)
tree0c5658eacb8aeca13556314cd0cffdf1db88f5c9 /oauthlib/oauth2
parent3bb2bfbb593386169e997e3332b236c077a546db (diff)
downloadoauthlib-edab385f951e38d65a25003f193793b63037bdec.tar.gz
Change logging namespace to a tiered one.
Rather than have all logging under oauthlib we now have it per file using __name__. Users who wish to enable or disable all logging can still do so by enabling or disabling the oauthlib logging namespace.
Diffstat (limited to 'oauthlib/oauth2')
-rw-r--r--oauthlib/oauth2/rfc6749/__init__.py5
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/authorization.py6
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/base.py5
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/resource.py6
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/revocation.py6
-rw-r--r--oauthlib/oauth2/rfc6749/endpoints/token.py7
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/authorization_code.py5
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/base.py5
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/client_credentials.py5
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/implicit.py6
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/refresh_token.py6
-rw-r--r--oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py5
-rw-r--r--oauthlib/oauth2/rfc6749/request_validator.py4
13 files changed, 55 insertions, 16 deletions
diff --git a/oauthlib/oauth2/rfc6749/__init__.py b/oauthlib/oauth2/rfc6749/__init__.py
index a871ced..05a7601 100644
--- a/oauthlib/oauth2/rfc6749/__init__.py
+++ b/oauthlib/oauth2/rfc6749/__init__.py
@@ -9,12 +9,15 @@ for consuming and providing OAuth 2.0 RFC6749.
from __future__ import absolute_import, unicode_literals
import functools
+import logging
-from oauthlib.common import log
from .errors import TemporarilyUnavailableError, ServerError
from .errors import FatalClientError, OAuth2Error
+log = logging.getLogger(__name__)
+
+
class BaseEndpoint(object):
def __init__(self):
self._available = True
diff --git a/oauthlib/oauth2/rfc6749/endpoints/authorization.py b/oauthlib/oauth2/rfc6749/endpoints/authorization.py
index 3b59bee..4244a88 100644
--- a/oauthlib/oauth2/rfc6749/endpoints/authorization.py
+++ b/oauthlib/oauth2/rfc6749/endpoints/authorization.py
@@ -8,10 +8,14 @@ for consuming and providing OAuth 2.0 RFC6749.
"""
from __future__ import absolute_import, unicode_literals
-from oauthlib.common import Request, log
+import logging
+
+from oauthlib.common import Request
from .base import BaseEndpoint, catch_errors_and_unavailability
+log = logging.getLogger(__name__)
+
class AuthorizationEndpoint(BaseEndpoint):
"""Authorization endpoint - used by the client to obtain authorization
diff --git a/oauthlib/oauth2/rfc6749/endpoints/base.py b/oauthlib/oauth2/rfc6749/endpoints/base.py
index e66ab75..24f00d9 100644
--- a/oauthlib/oauth2/rfc6749/endpoints/base.py
+++ b/oauthlib/oauth2/rfc6749/endpoints/base.py
@@ -9,12 +9,13 @@ for consuming and providing OAuth 2.0 RFC6749.
from __future__ import absolute_import, unicode_literals
import functools
-
-from oauthlib.common import log
+import logging
from ..errors import TemporarilyUnavailableError, ServerError
from ..errors import FatalClientError, OAuth2Error
+log = logging.getLogger(__name__)
+
class BaseEndpoint(object):
def __init__(self):
diff --git a/oauthlib/oauth2/rfc6749/endpoints/resource.py b/oauthlib/oauth2/rfc6749/endpoints/resource.py
index afe5f74..ee23d35 100644
--- a/oauthlib/oauth2/rfc6749/endpoints/resource.py
+++ b/oauthlib/oauth2/rfc6749/endpoints/resource.py
@@ -8,10 +8,14 @@ for consuming and providing OAuth 2.0 RFC6749.
"""
from __future__ import absolute_import, unicode_literals
-from oauthlib.common import Request, log
+import logging
+
+from oauthlib.common import Request
from .base import BaseEndpoint, catch_errors_and_unavailability
+log = logging.getLogger(__name__)
+
class ResourceEndpoint(BaseEndpoint):
"""Authorizes access to protected resources.
diff --git a/oauthlib/oauth2/rfc6749/endpoints/revocation.py b/oauthlib/oauth2/rfc6749/endpoints/revocation.py
index fcdeb98..45e8080 100644
--- a/oauthlib/oauth2/rfc6749/endpoints/revocation.py
+++ b/oauthlib/oauth2/rfc6749/endpoints/revocation.py
@@ -9,12 +9,16 @@ An implementation of the OAuth 2 `Token Revocation`_ spec (draft 11).
"""
from __future__ import absolute_import, unicode_literals
-from oauthlib.common import Request, log
+import logging
+
+from oauthlib.common import Request
from .base import BaseEndpoint, catch_errors_and_unavailability
from ..errors import InvalidClientError, UnsupportedTokenTypeError
from ..errors import InvalidRequestError, OAuth2Error
+log = logging.getLogger(__name__)
+
class RevocationEndpoint(BaseEndpoint):
"""Token revocation endpoint.
diff --git a/oauthlib/oauth2/rfc6749/endpoints/token.py b/oauthlib/oauth2/rfc6749/endpoints/token.py
index 68d36ca..267490f 100644
--- a/oauthlib/oauth2/rfc6749/endpoints/token.py
+++ b/oauthlib/oauth2/rfc6749/endpoints/token.py
@@ -8,11 +8,16 @@ for consuming and providing OAuth 2.0 RFC6749.
"""
from __future__ import absolute_import, unicode_literals
-from oauthlib.common import Request, log
+import logging
+
+from oauthlib.common import Request
from .base import BaseEndpoint, catch_errors_and_unavailability
+log = logging.getLogger(__name__)
+
+
class TokenEndpoint(BaseEndpoint):
"""Token issuing endpoint.
diff --git a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
index 1d84337..65e9c65 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
@@ -4,16 +4,19 @@ oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import unicode_literals, absolute_import
+
import json
+import logging
from oauthlib import common
-from oauthlib.common import log
from oauthlib.uri_validate import is_absolute_uri
from .base import GrantTypeBase
from .. import errors
from ..request_validator import RequestValidator
+log = logging.getLogger(__name__)
+
class AuthorizationCodeGrant(GrantTypeBase):
"""`Authorization Code Grant`_
diff --git a/oauthlib/oauth2/rfc6749/grant_types/base.py b/oauthlib/oauth2/rfc6749/grant_types/base.py
index a3dd87c..9121580 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/base.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/base.py
@@ -5,9 +5,12 @@ oauthlib.oauth2.rfc6749.grant_types
"""
from __future__ import unicode_literals, absolute_import
-from oauthlib.common import log
+import logging
+
from oauthlib.oauth2.rfc6749 import errors, utils
+log = logging.getLogger(__name__)
+
class GrantTypeBase(object):
error_uri = None
diff --git a/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py b/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py
index 9bc2c8f..9437b11 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/client_credentials.py
@@ -4,13 +4,16 @@ oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import unicode_literals, absolute_import
+
import json
-from oauthlib.common import log
+import logging
from .base import GrantTypeBase
from .. import errors
from ..request_validator import RequestValidator
+log = logging.getLogger(__name__)
+
class ClientCredentialsGrant(GrantTypeBase):
"""`Client Credentials Grant`_
diff --git a/oauthlib/oauth2/rfc6749/grant_types/implicit.py b/oauthlib/oauth2/rfc6749/grant_types/implicit.py
index fcdb606..c3335af 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/implicit.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/implicit.py
@@ -4,14 +4,18 @@ oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import unicode_literals, absolute_import
+
+import logging
+
from oauthlib import common
-from oauthlib.common import log
from oauthlib.uri_validate import is_absolute_uri
from .base import GrantTypeBase
from .. import errors
from ..request_validator import RequestValidator
+log = logging.getLogger(__name__)
+
class ImplicitGrant(GrantTypeBase):
"""`Implicit Grant`_
diff --git a/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py b/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py
index 51b6487..f6c27ea 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py
@@ -4,14 +4,16 @@ oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import unicode_literals, absolute_import
-import json
-from oauthlib.common import log
+import json
+import logging
from .base import GrantTypeBase
from .. import errors, utils
from ..request_validator import RequestValidator
+log = logging.getLogger(__name__)
+
class RefreshTokenGrant(GrantTypeBase):
"""`Refresh token grant`_
diff --git a/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py b/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py
index ae73d31..07aa9c1 100644
--- a/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py
+++ b/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py
@@ -4,13 +4,16 @@ oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import unicode_literals, absolute_import
+
import json
-from oauthlib.common import log
+import logging
from .base import GrantTypeBase
from .. import errors
from ..request_validator import RequestValidator
+log = logging.getLogger(__name__)
+
class ResourceOwnerPasswordCredentialsGrant(GrantTypeBase):
"""`Resource Owner Password Credentials Grant`_
diff --git a/oauthlib/oauth2/rfc6749/request_validator.py b/oauthlib/oauth2/rfc6749/request_validator.py
index a66ddc2..01e025d 100644
--- a/oauthlib/oauth2/rfc6749/request_validator.py
+++ b/oauthlib/oauth2/rfc6749/request_validator.py
@@ -4,10 +4,10 @@ oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import unicode_literals, absolute_import
-import logging
+import logging
-log = logging.getLogger('oauthlib')
+log = logging.getLogger(__name__)
class RequestValidator(object):