Skip to main content

A lightweight and efficient asynchronous logging package for Python

Project description

asynclogger

A lightweight and efficient asynchronous logging package for logging messages to the console and files. Supports colored output, dynamic log paths, and customizable log levels.

Features

  • Asynchronous Logging: Non-blocking logging for improved performance.
  • Console and File Logging: Supports simultaneous logging to console and files.
  • Colored Output: Differentiates log levels using colors for better readability.
  • Dynamic Log Paths: Change log file paths dynamically without restarting.
  • Custom Log Levels: Define and configure custom logging levels.

Installation

pip install asynclogger

Usage

Basic Example

from asynclogger import logger

logger.config('./logs/test.log', log_to_console=True)

async def main():
    await logger.info('Hello, world!')

if __name__ == '__main__':
    asyncio.run(main())

Configuration Options

Option Type Default Description
log_format String {isoformat} {group} {level} {message} Format used for logging messages.
output List ["console"] Specifies outputs.
colorize Boolean or Dict True Takes either a boolean or a dict specifying a color for each log level.
wrapper Dict {} Contains a dict of wrapper functions for each format variable (isoformat, group, level ...).

Dynamic Log Path Change

logger.config('./logs/%Y/%B/{safedate}.log', log_to_console=True)

Custom Log Levels

await logger.log('custom', 'This is a custom log level message')

Coloring Output

from colorist import Color

logger.config('./logs/test.log', log_to_console=True, colorize={
    'ERROR': Color.GREEN
})

Wrapping Variables

logger.config('./logs/test.log', log_to_console=True, wrapper={'group': lambda x: f'({x})'})

License

MIT

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

asynclogger-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

asynclogger-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file asynclogger-0.1.0.tar.gz.

File metadata

  • Download URL: asynclogger-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for asynclogger-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d70a758ad010ccc0fb68d65cf4b4d1ebe9ede1ed281e8648d6088aa97d86c11f
MD5 2df90133637f92a29146a5c7bd23a406
BLAKE2b-256 26bbc7860de2eba280bf99136f0893fe86c140de7f6bdfa52e639d981c669539

See more details on using hashes here.

Provenance

The following attestation bundles were made for asynclogger-0.1.0.tar.gz:

Publisher: pypi.yml on ixlammm/asynclogger

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file asynclogger-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: asynclogger-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for asynclogger-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ed764b6e93e4e71611c822018653c61d751d0d1c68622967d7cbbb59b309abb
MD5 5d6011e57eee21c698bf01d5b1bc8f30
BLAKE2b-256 7d0f681fc5cdb79b50bc723354db0018d92af9d590067fcd1f9f0b74143d7b34

See more details on using hashes here.

Provenance

The following attestation bundles were made for asynclogger-0.1.0-py3-none-any.whl:

Publisher: pypi.yml on ixlammm/asynclogger

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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