Skip to main content

Simple decorator-logger

Project description

Decorator Logging Library

What is this?

The module allows you to wrap function with a logger (based on loguru) and specify some additional options (log level, log timing)


Using

class Roles:
    def __init__(self, file_name: str):
        self.file_name = file_name
        self.roles = self.read()

    @SyncLoggable()
    def add_role(self, user_id: int, role: Role) -> None:
        user_roles = self.roles.get(user_id, [])
        user_roles.append(role)
        self.roles[user_id] = user_roles
        self.save()

    def save(self) -> None:
        ...

    def read(self) -> dict[int, list[Role]]:
        ...

example output for add_role(123, Role.ADMIN):

INFO: Executing add_role with args: ['123', 'Role.ADMIN']}

INFO: Success add_role returned: None


Developer

GitHub: link

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

decorator_logger-1.0.2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

decorator_logger-1.0.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file decorator_logger-1.0.2.tar.gz.

File metadata

  • Download URL: decorator_logger-1.0.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for decorator_logger-1.0.2.tar.gz
Algorithm Hash digest
SHA256 565f7c00fe544bb41506cb23540402d2cdbd3397f0c6a5731763051c740c54af
MD5 7b98dd51dfab427848816728b4bff251
BLAKE2b-256 7ca02a01b30927046d69a8409cb01b82cb3eab16de7319111b101a81096eca8c

See more details on using hashes here.

File details

Details for the file decorator_logger-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for decorator_logger-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 81250e73cc5227f5d11c0b840925aeb5f7ecb4d558837cb43e220898847ea234
MD5 2330b3b08b6e2b178d35c0d0f26ee152
BLAKE2b-256 884dd51679aa3291e8b694e3d04d97f488c1728731db4ed49b9b8e32c954243d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page