Skip to content

Commit

Permalink
New API: Add debug logging
Browse files Browse the repository at this point in the history
The debug logging could be useful to identify differences between
spec_versions and debug what "Signed" objects have you created.

Signed-off-by: Martin Vrachev <[email protected]>
  • Loading branch information
MVrachev committed Jun 8, 2021
1 parent d878617 commit 7bb8b4a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tuf/api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@

logger = logging.getLogger(__name__)

logger.debug(
"The code supports %s of the spec version", ".".join(SPECIFICATION_VERSION)
)


class Metadata:
"""A container for signed TUF metadata.
Expand Down Expand Up @@ -364,6 +368,9 @@ def __init__(
raise ValueError(f"version must be > 0, got {version}")
self.version = version
self.unrecognized_fields: Mapping[str, Any] = unrecognized_fields or {}
attrs = vars(self)
attrs_msg = ", ".join("%s: %s" % item for item in attrs.items())
logger.debug("Created a Signed instance with: %s", attrs_msg)

@abc.abstractmethod
def to_dict(self) -> Dict[str, Any]:
Expand Down

0 comments on commit 7bb8b4a

Please sign in to comment.