Skip to content

Commit

Permalink
Using getLogger and makeing Logger instance
Browse files Browse the repository at this point in the history
  • Loading branch information
msetina committed May 2, 2024
1 parent 9bf2d76 commit e8e36b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkcs11_cryptography_keys/pkcs11_URI/pkcs11_URI.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from logging import Logger
from logging import Logger, getLogger
from re import compile
from typing import Any
from urllib.parse import unquote
Expand Down Expand Up @@ -44,7 +44,7 @@ def __init__(
self._location: dict[str, str] = location
self._query: dict[str, str] = query
self._operations: list[tuple[int, str]] = []
self._logger = logger if logger is not None else Logger("PKCS11 uri")
self._logger = logger if logger is not None else getLogger("PKCS11 uri")

def __get_object_value(self, value: str):
return value
Expand Down Expand Up @@ -90,7 +90,7 @@ def parse(
uri: str,
logger: Logger | None,
) -> PKCS11URI:
local_logger = logger if logger is not None else Logger("URI parser")
local_logger = logger if logger is not None else getLogger("URI parser")
grob = compile("(.+?)(\?.+?)?(#.+)?$")
m = grob.match(uri)
if m is not None:
Expand Down
6 changes: 4 additions & 2 deletions pkcs11_cryptography_keys/sessions/PKCS11_session.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from logging import Logger
from logging import Logger, getLogger


# contextmanager to facilitate connecting to card token
class PKCS11Session(object):
def __init__(self, logger: Logger | None):
self._logger = logger if logger is not None else Logger("PKCS11 sesion")
self._logger = (
logger if logger is not None else getLogger("PKCS11 session")
)
# session for interacton with the card
self._session = None
# does user need to be logged in to use session
Expand Down

0 comments on commit e8e36b3

Please sign in to comment.