Skip to main content

SDK para integrar aplicaciones Python con Logbee

Project description

Logbee SDK para Python

SDK oficial para integrar aplicaciones Python con Logbee, una plataforma de monitoreo y gestión de errores.

Instalación

pip install logbee-sdk

Dependencias opcionales

Para usar el SDK con frameworks específicos, puedes instalar las dependencias correspondientes:

# Para Flask
pip install logbee-sdk[flask]

# Para FastAPI
pip install logbee-sdk[fastapi]

# Para Django
pip install logbee-sdk[django]

# Para todos los frameworks
pip install logbee-sdk[all]

Uso

Integración con Flask

from flask import Flask
from logbee import init_logbee_flask

app = Flask(__name__)

# Inicializar Logbee
init_logbee_flask(app, api_key="tu-api-key", environment="production")

@app.route('/')
def hello():
    return "Hello World!"

Integración con FastAPI

from fastapi import FastAPI
from logbee import init_logbee_fastapi

app = FastAPI()

# Inicializar Logbee
init_logbee_fastapi(app, api_key="tu-api-key", environment="production")

@app.get('/')
def hello():
    return {"message": "Hello World!"}

Integración con Django

En tu archivo settings.py:

MIDDLEWARE = [
    # ... otros middlewares
    'logbee.LogbeeDjangoMiddleware',
]

# Configuración de Logbee
LOGBEE = {
    'api_key': 'tu-api-key',
    'environment': 'production',
    'service_name': 'mi-aplicacion-django',
}

Envío manual de errores

from logbee import send_error_to_logbee

try:
    # Código que puede generar excepciones
    result = 1 / 0
except Exception as e:
    # Enviar error a Logbee
    send_error_to_logbee(
        error=e,
        context={
            "service_name": "mi-servicio",
            "environment": "production",
            "custom": {"operacion": "división"}
        },
        api_key="tu-api-key"
    )
    # Puedes relanzar la excepción o manejarla según tu lógica
    raise

Uso del decorador para capturar errores

from logbee import catch_and_log_errors

@catch_and_log_errors(
    service_name="mi-servicio",
    environment="production",
    api_key="tu-api-key"
)
def funcion_con_posibles_errores():
    # Si ocurre una excepción aquí, será enviada automáticamente a Logbee
    result = 1 / 0
    return result

Opciones de configuración

El SDK de Logbee admite las siguientes opciones:

  • api_key: Tu API key de Logbee (requerido)
  • environment: Entorno de ejecución (ej. "development", "production")
  • service_name: Nombre de tu servicio o aplicación
  • capture_body: Si se debe capturar el cuerpo de las peticiones (por defecto: True)
  • capture_headers: Si se deben capturar los headers de las peticiones (por defecto: True)
  • capture_query_params: Si se deben capturar los parámetros de consulta (por defecto: True)
  • mask_sensitive_data: Si se deben ocultar datos sensibles (por defecto: True)
  • sensitive_fields: Lista de campos que deben ocultarse (por defecto: ["password", "token", "secret", "credit_card", "card_number"])

Licencia

Este proyecto está bajo la licencia MIT - ver el archivo LICENSE para más detalles.

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

logbee_sdk-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

logbee_sdk-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file logbee_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: logbee_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for logbee_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ab87ab04aed45e513836c97e629f637c01ca70ebaed6070938e40c71461e9b4c
MD5 d993e440929271c16e324f5948de8588
BLAKE2b-256 0eacf6106adf810c28882b86fb0e9e0f9d124d364dafb037963b7ec8f884faaa

See more details on using hashes here.

File details

Details for the file logbee_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: logbee_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for logbee_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a869bd633885944687c8488c19b698aa66b76f8d624565c74edadb428aaa269d
MD5 09b22e243da2e3134674a7760e53c9a1
BLAKE2b-256 b9bcf414dc247e171bceb792709b5a759c3f45d54f3d355655eb84bf5a969ac6

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