Package: loggerflow
LoggerFlow\     \
  _\_____\
 | |   __  \___       /     __     __    __   ___   ___   ----         __
 | |  |__/     |     /    /   /  / __  / __  /__   /  /  /___  /     /   /   /  /  /
 | |      ____/     /___ /___/  /___/ /___/ /___  /     /     /___  /___/   /__/__/
 |_|_____/A new level of bug tracking for your Python projects.Changes (0.0.4 - actual)v. 0.0.4improved stacktrace cleaning fortraceback='clean';template for tracking the status of projects (will be added in v. 0.0.5);rename methodexclude_sending_filtertoexclude;added methodsend_traceback_to_backendfor manual sending of traceback to the backend;changes in project architecture.v. 0.0.3added thetraceback='full'attribute to the LoggerFlow constructor, which allows you to send full, clean or minimal traceback to the backend (depending on your preferences).
You can pass 3 parameters:full-  Sending full traceback on your backend/backends;clean- Sending your program's stacktrace (clearing lines that were are called from libraries);minimal- Sending a 1 line with name file, number line and last line of your traceback;minor fixes in project architecture;writing documentation for project.v. 0.0.2added logging in threads (to disable logging in threads - pass the parameter thread_logging=False to the LoggerFlow constructor);minor fixes;v. 0.0.1create project LoggerFlow;Simple start (with Telegram backend):from loggerflow.backends.telegram import TelegramBackend
from loggerflow import LoggerFlow


backend = TelegramBackend(
    token='telegram_token',
    chat_id=-123456789,
    authors=['@DeNRuDi', ]
)

lf = LoggerFlow(project_name='Test', backend=backend)
lf.run()

raise Exception('Test Error')Example with multiple backends:from loggerflow.backends.telegram import TelegramBackend
from loggerflow.backends.discord import DiscordBackend
from loggerflow import LoggerFlow

backend_telegram = TelegramBackend(
    token='bot_token',
    chat_id=-1234567890,
    authors=['@telegram_username', ]
)

backend_discord = DiscordBackend(
    webhook_url='webhook_url',
    authors=['@discord_username', ]
)

lf = LoggerFlow(project_name='Test', backend=[backend_telegram, backend_discord])
lf.run()

raise Exception('Test Error')Exclude traceback which should not be sent:lf = LoggerFlow(project_name='Test', backend=backend)
lf.exclude('ValueError')
lf.exclude('502 Bad Gateway')
lf.run()Simple integrations with frameworksDjangoFilesettings.py:import os
from pathlib import Path

from loggerflow.backends.file import FileBackend
from loggerflow import LoggerFlow

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.getenv('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ALLOWED_HOSTS = ['*']


lf = LoggerFlow(project_name='Test', backend=FileBackend('test.log'), traceback='clean')
lf.run()FastAPIFastAPIalready contains an automatic excepthook-handler, so errors must be sent
using thelf.send_traceback_to_backend(your_error)method.Example:from loggerflow.backends.file import FileBackend
from loggerflow import LoggerFlow

from fastapi.responses import JSONResponse
from fastapi import FastAPI

import traceback
import uvicorn

app = FastAPI()
lf = LoggerFlow(project_name='Test', backend=FileBackend(file='test.log'), traceback='clean')
lf.run()


@app.get('/')
async def index():
    return {"status": 200}


@app.exception_handler(Exception)
async def exception_handler(request, exc):
    lf.send_traceback_to_backend(traceback.format_exc())
    return JSONResponse({'status': 500})


if __name__ == '__main__':
    uvicorn.run(app=app)