Tekek
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
Metadata
Release files for tekek 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tekek-0.2.6.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tekek-0.2.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.3 kB
Release files / tekek-0.2.6.tar.gz
| Download URL | tekek-0.2.6.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4c1b280f86d99351cc1b86f6c861f08c0cb7870f751da0353669cc537793e8e
|
|
BLAKE2b-256 checksum How to use checksums |
0dc98f50cd8aeb936d7b2c9bb9616ce638b5f03fabfc111bd9582d4f060fad49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / tekek-0.2.6-py3-none-any.whl
| Download URL | tekek-0.2.6-py3-none-any.whl |
|---|---|
| Size | 21.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf0c0625145bbbbee7f39cb6842ff3d10d55d077054bd3eee9046d865951e886
|
|
BLAKE2b-256 checksum How to use checksums |
06ae1df3dc43e29dfcfde799aea8faf64d7f720bf53ea1cd0838d3bee8d5427f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|