Skip to main content

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


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)

Uploaded Source

Built Distribution

aliyun_sls_logger-0.3.0-py3-none-any.whl (21.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page