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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d70a758ad010ccc0fb68d65cf4b4d1ebe9ede1ed281e8648d6088aa97d86c11f
|
|
| MD5 |
2df90133637f92a29146a5c7bd23a406
|
|
| BLAKE2b-256 |
26bbc7860de2eba280bf99136f0893fe86c140de7f6bdfa52e639d981c669539
|
Provenance
The following attestation bundles were made for asynclogger-0.1.0.tar.gz:
Publisher:
pypi.yml on ixlammm/asynclogger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asynclogger-0.1.0.tar.gz -
Subject digest:
d70a758ad010ccc0fb68d65cf4b4d1ebe9ede1ed281e8648d6088aa97d86c11f - Sigstore transparency entry: 173626227
- Sigstore integration time:
-
Permalink:
ixlammm/asynclogger@ab3de348145cc62e0a84a885106c570ef46dd885 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ixlammm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@ab3de348145cc62e0a84a885106c570ef46dd885 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ed764b6e93e4e71611c822018653c61d751d0d1c68622967d7cbbb59b309abb
|
|
| MD5 |
5d6011e57eee21c698bf01d5b1bc8f30
|
|
| BLAKE2b-256 |
7d0f681fc5cdb79b50bc723354db0018d92af9d590067fcd1f9f0b74143d7b34
|
Provenance
The following attestation bundles were made for asynclogger-0.1.0-py3-none-any.whl:
Publisher:
pypi.yml on ixlammm/asynclogger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asynclogger-0.1.0-py3-none-any.whl -
Subject digest:
9ed764b6e93e4e71611c822018653c61d751d0d1c68622967d7cbbb59b309abb - Sigstore transparency entry: 173626228
- Sigstore integration time:
-
Permalink:
ixlammm/asynclogger@ab3de348145cc62e0a84a885106c570ef46dd885 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ixlammm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@ab3de348145cc62e0a84a885106c570ef46dd885 -
Trigger Event:
push
-
Statement type: