httpheader for logging on async
Project description
aiohandler
aiohandler = aiohttp handler
loggingモジュールをノンブロッキングでwebhookに送信する拡張ライブラリ
使い方
pip install -i https://test.pypi.org/simple/ aiohandler
import asyncio
import logging
import aiohandler
WEBHOOK_URL = "Your webhook url"
logger = logging.getLogger()
handler = aiohandler.AioHTTPHandler(WEBHOOK_URL, method="POST", body="content")#bodyはwebhookで送信するパラメータ
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()
ご協力してくださった皆様ありがとうございます!
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
aiohandler-0.0.5.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for aiohandler-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc14c9abf504ca2a0b6813416bd69341c537d8a652d3c14467fd1390edd0a4ee |
|
MD5 | 7e61be6befa0a760f28bddaa7a610528 |
|
BLAKE2b-256 | 831d106c89f65ff8a78a53ca497242fbb99efa58341c9c25598e8af658c5237f |