Skip to main content

httpheader for logging on async

Project description

aiohandler

aiohandler = aiohttp http handler

aiohandler is a logging extension module.
By using this module, logs can be sent by webhook.

installing

Install and update using pip:

pip install aiohandler

A simple example.
Enter the parameters required for sending the webhook in the body.

import asyncio
import logging
import aiohandler

WEBHOOK_URL = "Your webhook url"
logger = logging.getLogger()
handler = aiohandler.AioHTTPHandler(WEBHOOK_URL, method="POST", body="content")
logger.addHandler(handler)

loop = asyncio.get_event_loop()

async def main():
    print("hello!")
    logging.info('info')
    logging.debug('debug')
    logging.error('error')
    await asyncio.sleep(1)
    logging.warning('warning')
    logging.critical('critical')
    print("hello world!")

if __name__ == "__main__":
    loop.create_task(main())
    loop.run_forever()

Thank you to everyone who Helped me (#^^#)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aiohandler, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size aiohandler-0.1.0-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aiohandler-0.1.0.tar.gz (2.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page