Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

grarich/aiohandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (#^^#)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages