async aliyun sls logger
Project description
aliyun-sls-logger
aliyun-sls-logger
is an implementation of asynchronous Aliyun logging designed to integrate with asynchronous code. This library provides no additional features beyond logging.
Installation
To install aliyun-sls-logger
, simply use pip:
pip install aliyun-sls-logger
Usage
To use aliyun-sls-logger
, create an instance of the QueuedLogHandler
class and add it to your logger. The QueuedLogHandler
requires the following parameters:
access_key_id
: The access key ID for your Aliyun account.access_key_secret
: The access key secret for your Aliyun account.endpoint
: The endpoint for your Aliyun SLS service.project
: The name of the project to log to.logstore
: The name of the logstore to log to.
Once you have created an instance of the QueuedLogHandler
, you can add it to your logger like any other handler:
from aiologger import Logger
from aiologger.levels import LogLevel
from aliyun_sls_logger.logger_handler import QueuedLogHandler
logger = Logger(name=__name__, level=LogLevel.INFO)
handler = QueuedLogHandler(
access_key_id='your_access_key_id',
access_key='your_access_key_secret',
end_point='your_endpoint',
project='your_project',
log_store='your_logstore',
extract_json=True,
extract_json_prefix='test_'
)
logger.add_handler(handler)
You can then use the logger as usual:
await logger.info('This is a log message.')
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
aliyun_sls_logger-0.3.0.tar.gz
(17.6 kB
view hashes)
Built Distribution
Close
Hashes for aliyun_sls_logger-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c57c7981beccd70814b38aeebcd3e9c9ad8212024438e57aa4c58ccd457f4ee8 |
|
MD5 | 5c7a4d3e26dbc8d5a81659fceed3548b |
|
BLAKE2b-256 | fedec465cb250804c6b71209d95c1f1a4626e0012077ca81f3297cb3bd1e9d6e |