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.3.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.3-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: decorator_logger-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 07a2c1779af5e8d8dd3eff5ea3a1fd7a4d0c083571d47c2628726e41499bd4d3
MD5 966557131d3ffb0dcb4acbe44eda57c1
BLAKE2b-256 bb47f8ce8f9560b488925766d12a1bc435336d0f319cad1c4de9ed70691697f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for decorator_logger-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d8763a5da4b8a087a5b5efbd1fcc976b91a19844bfd3d20a892e896843cc6835
MD5 4e67f7865708be24b6f6a150b0277c96
BLAKE2b-256 581c022abc88ce02105f53793105feff3626445780b73f169c9c58cf9add5ea1

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