Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Logger Python Plugin

The Logger plugin implements the logger-interface from the ens/wraps.eth:logger@1.0.0 package (see ./src/schema.graphql). By default, it logs all events using the Python logging module. You can customize this behavior by setting the Logger property on the plugin's configuration object (examples below).

Usage

1. Configure Client

When creating your Polywrap Python client, add the logger plugin:

from polywrap_client_config_builder  import PolywrapClientConfigBuilder
from polywrap_logger_plugin import logger_plugin
from polywrap_client import PolywrapClient

config = PolywrapClientConfigBuilder().set_package(
    uri=Uri.from_str("plugin/logger"),
    package=logger_plugin()
).set_interface(
    interface=Uri.from_str("ens/wraps.eth:logger@1.0.0"),
    implementations=[Uri.from_str("plugin/logger")]
).set_redirect(
    Uri.from_str("ens/wraps.eth:logger@1.0.0"),
    Uri.from_str("plugin/logger")
).build()
client = PolywrapClient(config)

2. Invoke The Logger

Invocations to the logger plugin can be made via the interface URI (which will get redirected), or the plugin's URI directly:

await client.invoke({
  'uri': 'ens/wraps.eth:logger@1.0.0' | 'plugin/logger',
  'method': 'log',
  'args': {
    'level': 'INFO',
    'message': 'foo bar baz'
  }
})

3. Customize The Logger

When adding the logger to your client, you can add your own custom log function:

config = PolywrapClientConfigBuilder().set_package(
    uri=Uri.from_str("plugin/logger"),
    package=logger_plugin(LoggerConfig(logger=YourLogger(), level=LogLevel.INFO))
).set_interface(
    interface=Uri.from_str("ens/wraps.eth:logger@1.0.0"),
    implementations=[Uri.from_str("plugin/logger")]
).set_redirect(
    Uri.from_str("ens/wraps.eth:logger@1.0.0"),
    Uri.from_str("plugin/logger")
).build()

4. Add Multiple Loggers

Multiple logger implementations can be added to the client:

config = PolywrapClientConfigBuilder().set_package(
    uri=Uri.from_str("plugin/logger"),
    package=logger_plugin(LoggerConfig(logger=YourLogger(), level=LogLevel.INFO))
).set_interface(
    interface=Uri.from_str("ens/wraps.eth:logger@1.0.0"),
    implementations=[Uri.from_str("plugin/logger"), Uri.from_str("plugin/custom-logger")]
).set_package(
    uri=Uri.from_str("plugin/custom-logger"),
    package=custom_logger_plugin()
).build()

5. Invoke All Logger Implementations

When you'd like to log something to more than one logger, you can invoke all implementations of the logger interface:

implementations = client.get_implementations('ens/wraps.eth:logger@1.0.0')

for impl in implementations:
    await client.invoke({
        'uri': impl,
        'method': 'log',
        'args': {
            'level': 'INFO',
            'message': 'message'
        }
    })

Metadata

Release files for polywrap-logger-plugin 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polywrap-logger-plugin 0.1.0a1
File Size Uploaded Provenance Actions
polywrap_logger_plugin-0.1.0a1.tar.gz 2.5 kB Without provenance Details for polywrap_logger_plugin-0.1.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for polywrap-logger-plugin 0.1.0a1
File Interpreter ABI Platform Actions
polywrap_logger_plugin-0.1.0a1-py3-none-any.whl Python 3 none any Details for polywrap_logger_plugin-0.1.0a1-py3-none-any.whl

Total release size: 5.2 kB

Release files / polywrap_logger_plugin-0.1.0a1.tar.gz

Download URL polywrap_logger_plugin-0.1.0a1.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fafaaabb0acb1d4267617b9320f2c586ef0e5179f24f22b9429cc19eefa9e9c9
BLAKE2b-256 checksum
How to use checksums
3d16713d3791c42c0a4746217f4acb7235392ad82523c26b9009745bbb2dba65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1036-azure

Release files / polywrap_logger_plugin-0.1.0a1-py3-none-any.whl

Download URL polywrap_logger_plugin-0.1.0a1-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86b04b1edd6d8136f204440647a69a7abd9f14d74201400c824bc83e7c11a0f7
BLAKE2b-256 checksum
How to use checksums
35bf9e6689193bd4b49c9e81e02873088878f2c25d2e941aaa7b1f6ee958e19c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.11 Linux/5.15.0-1036-azure

Security for polywrap-logger-plugin 0.1.0a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page