Skip to main content

An Asynchronous Remote and Local Debugging Tools

Project description

tekek

Tekek

Travis (.org) Travis (.org) PyPI - Downloads PyPI - License PyPI PyPI - Status PyPI - Format PyPI - Python Version

Tekek [təʔkəʔ] is easy to use, fast, server-agnostic, asynchronous, highly configurable local and remote logging tool

Features

  • Semi-Direct Replacement for python built-in's logger
  • Asynchronous
  • Support Websocket (WIP)
  • Reliable Remote Logging
  • Reliable File Logging
  • Reliable Console Logging
  • Highly Configurable

Installation

Tekek is available via PyPI you can install it using pip

python3 -m pip install tekek

Import Tekek and instantiate.

Hello World

from tekek import Tekek


logger = Tekek(name=__name__)

By default, tekek came with 7 levels of log record

logger.log("MESSAGE")
logger.debug("MESSAGE")
logger.info("MESSAGE")
logger.warning("MESSAGE")
logger.error("MESSAGE")
logger.exception("MESSAGE")
logger.critical("MESSAGE")

example basic usage:

def function_a():
    logger.log("function a starts !", identifier="function_a")
    try:
        ...  # Some Algorithm
        logger.info("finished doing things", "function_a")
    except Exception as e:
        logger.exception("Exception raised {}".format(e), "function_a")

    logger.debug(identifier="function_a", message="function a finished !")
    return

def function_b():
    logger.error("this error came from function b", "function_a")

and yes it is regular function not an async function. why ? Because Tekek is smart enough to handle it for you. don't worry it barely scratch your application performance

Compatibility Example

Sanic

oh yeah, if you Gotta Go Fast, you need to develop it FAST ! use tekek as your logging and debugging tool !

from sanic import Sanic
from sanic.response import json
from tekek import Tekek

app = Sanic("sanic_example")
logger = Tekek("sanic_example", app=app)


@app.route("/", methods=["GET"])
async def root(request):
    logger.log("root accessed ! hello world!", "root")
    return json(
        {
            "status": "Hello World!"
        }
    )

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8000)

Fast API

A beautiful API Framework need a beautiful tekek as well ;)

from fastapi import FastAPI
from tekek import Tekek


app = FastAPI()
logger = Tekek("my_fast_api", app=app)


@app.get("/")
async def root():
    logger.log("root accessed ! hello world!", "root")
    return {"status": "Hello World!"}

Your Own Script!

Of course you can use your own app! let's create my_app as an example

using coroutine function

import asyncio
from tekek import Tekek


logger = Tekek("mah_own")


async def my_app(some_param: int):
    logger.log(f"My App Run Successfully! {some_param}")
    ...  # Your Beautiful app

    return True


async def main():
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)

    await asyncio.gather(
        my_app(3),
        logger.start()
    )


if __name__ == '__main__':
    asyncio.run(main())

using class

import asyncio
from tekek import Tekek


logger = Tekek("mah_own")


class MyApp:
    def __init__(self):
        self.some_vars = 3

    async def app(self):
        logger.log(f"App Ran! {self.some_vars}")
        ...  # Your beautiful app

    async def start(self):
        asyncio.ensure_future(self.app())


my_app = MyApp()


async def main():
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)

    await asyncio.gather(
        my_app.start(),
        logger.start()
    )


if __name__ == '__main__':
    asyncio.run(main())

Da Real Deal!

Go Ahead and Read : Usage Documentations

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

tekek-0.2.6.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tekek-0.2.6-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file tekek-0.2.6.tar.gz.

File metadata

  • Download URL: tekek-0.2.6.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for tekek-0.2.6.tar.gz
Algorithm Hash digest
SHA256 b4c1b280f86d99351cc1b86f6c861f08c0cb7870f751da0353669cc537793e8e
MD5 f1827e275282230a956b9d33efe7a6ee
BLAKE2b-256 0dc98f50cd8aeb936d7b2c9bb9616ce638b5f03fabfc111bd9582d4f060fad49

See more details on using hashes here.

File details

Details for the file tekek-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: tekek-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for tekek-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 bf0c0625145bbbbee7f39cb6842ff3d10d55d077054bd3eee9046d865951e886
MD5 6cd3a1feb334fde4bbeb839a37f3b187
BLAKE2b-256 06ae1df3dc43e29dfcfde799aea8faf64d7f720bf53ea1cd0838d3bee8d5427f

See more details on using hashes here.

Supported by

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