Skip to main content

Asynchronous high-level logging wrapper (via aiologger)


📦 Package Info

PyPI Python Test-coverage

en ru


Attention! ⚠

This wrapper is not complete, the functionality may change depending on the versions


🔹Main function:

🔶 Asynchronous logging with recording to a file of "today" day


🔹Installation?:🧩

pip install aiologger_x9_wrapper

Attention! This module will not work without the libraries: aiofiles, aiologger


🔹Import the dependencies:

from aiologger_x9_wrapper import (
    # Enums: (Required)
    "Levels",
    "LogFormats",

    # Main classes: (Required)
    "LogFormatter",
    "FolderHandler",
    "Logger",

    # Functions:
    "shutdown_loggers",  # Required if you want to manually clean up storage

    # Internals: (Optional)
    "LOGGERS_STORAGE",
    "FormatterDTO",
    "FolderHandlerDTO",
    "AsyncLogger",
)

🔹Quick Reference on Dependencies:

Levels -> Enum class with allowed logging levels
LogFormats -> Enum class with allowed parts of log output format

LogFormatter -> Determines the format of log output (What will be written to the log, with what separator, in what time format)
FolderHandler -> Determines the name and location of the directory for log files.

Logger -> Main logging configuration class. Accepts formatter and file handler and also a logger storage (Optional)

shutdown_loggers -> logger storage clearing function. If no storage is passed, the base one is cleared

LOGGERS_STORAGE -> Basic Logger Storage
FormatterDTO -> handler dataclass
FolderHandlerDTO -> handler dataclass
AsyncLogger -> A custom type used for annotations, typically logger store values: Dict[str, AsyncLogger]

🔹How to use?:


Define the required log output format using LogFormatter:

MY_LOG_FORMATTER: LogFormatter = LogFormatter(
    log_format=(LogFormats.TIME, LogFormats.NAME, LogFormats.LEVEL, LogFormats.MESSAGE),  # default
    separator=" - ",  # default
    datettime_format= "%d.%m.%Y %H:%M"  # default
)

Define the attributes of the created folder via the FolderHandler class:

MY_FOLDER_HANDLER: FolderHandler = FolderHandler(
    path=Path(__file__).parent,  # Required, or path="log_folder"
    name="logs"  # default
)

Define a logger with created configurations:

# Optional: create our own logger storage
CUSTOM_LOGGER_STORAGE: Dict[str, AsyncLogger] = {}

MY_LOGGER: Logger = Logger(
    log_formatter=MY_LOG_FORMATTER,
    folder_handler=MY_FOLDER_HANDLER,
    loggers_storage=CUSTOM_LOGGER_STORAGE
)

Use the write_log method of the created class instance:

await MY_LOGGER.write_log(
    log_level=Levels.INFO/DEBUG/WARNING/ERROR/CRITICAL,
    message="Hello world!",
    logger_name="SERVICE"  # Optional
)

If you want to manually clear the storage, use the shutdown_loggers function:

await shutdown_loggers(loggers_storage=CUSTOM_LOGGER_STORAGE)

# If loggers_storage was not passed, the underlying storage is used

Metadata

Release files for aiologger-x9-wrapper 0.2.2

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

Source distribution (sdist)

Source distribution for aiologger-x9-wrapper 0.2.2
File Size Uploaded Provenance Actions
aiologger_x9_wrapper-0.2.2.tar.gz 6.4 kB Without provenance Details for aiologger_x9_wrapper-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiologger-x9-wrapper 0.2.2
File Interpreter ABI Platform Actions
aiologger_x9_wrapper-0.2.2-py3-none-any.whl Python 3 none any Details for aiologger_x9_wrapper-0.2.2-py3-none-any.whl

Total release size: 14.2 kB

Release files / aiologger_x9_wrapper-0.2.2.tar.gz

Download URL aiologger_x9_wrapper-0.2.2.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
601d10fdb0844dc62e168d3af949885c89ba9e62722c12c3d74db02c173f8131
BLAKE2b-256 checksum
How to use checksums
6268a83336aa1e8d65de247a0cb4c83150ea348f592a9be8fcb8097fc2ffeff5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / aiologger_x9_wrapper-0.2.2-py3-none-any.whl

Download URL aiologger_x9_wrapper-0.2.2-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f23ba54b1d0a93ace7b0db5defae4f3b72c4a5050d48680d9cf52d630e162c2a
BLAKE2b-256 checksum
How to use checksums
2e078322fce916285dd1f87b55546faf9aa2dde041565278dddc736ee29742ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for aiologger-x9-wrapper 0.2.2

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

0.2.2 This release

2 release files No provenance

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