Skip to main content

cs2032-logger

Proyecto del curso CS2032 – Cloud Computing · UTEC

PyPI CI

utec-logger es un logger para Python con salida en consola a color, archivos locales y envío opcional a AWS CloudWatch Logs.

📖 Documentación: https://utec-logger.github.io

Características

  • Consola con colores por nivel (INFO, WARNING, ERROR, CRITICAL)
  • Archivos locales en logs/log-<archivo>-<timestamp>.log
  • Envío opcional a CloudWatch Logs, activado solo con variables de entorno
  • Indica el archivo y la línea desde donde se generó cada log
  • Singleton: una única instancia en toda la aplicación
  • Un fallo de CloudWatch nunca interrumpe tu aplicación

Instalación

pip install utec-logger

Requiere Python 3.8+.

Uso

from utec_logger import logger

logger.info("Iniciando el sistema")
logger.warning("Uso de memoria alto")
logger.error("No se pudo conectar a la base de datos")
logger.critical("Servicio caído")

También puedes usar la clase y los niveles directamente:

from utec_logger import Logger, Level

log = Logger()
log.log("Mensaje personalizado", level=Level.ERROR)

Salida

Consola y archivo:

2025-05-03 12:30:01.123 | INFO | main.py:23 | Iniciando el sistema

CloudWatch (el timestamp va en el evento):

INFO | main.py:23 | Iniciando el sistema

AWS CloudWatch (opcional)

El envío se activa cuando CLOUD_WATCH_GROUP y CLOUD_WATCH_STREAM están definidas. La conexión se hace en el primer log (no al importar) y el grupo y el stream se crean si no existen.

Variable Descripción
CLOUD_WATCH_GROUP Grupo de logs
CLOUD_WATCH_STREAM Stream de logs
AWS_REGION Región de AWS
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY Credenciales (opcional si usas un rol de IAM)
AWS_SESSION_TOKEN Para credenciales temporales (por ejemplo, AWS Academy)

Al conectarse, el logger muestra el estado en consola:

AWS Ready: 123456789012
CloudWatch Group: my-app-logs
CloudWatch Stream: dev-instance
CloudWatch Ready

Desarrollo

pip install -e ".[test]"
pytest

Las pruebas usan moto para simular CloudWatch, sin tocar AWS.

Publicación en PyPI

El workflow publish.yml corre las pruebas en cada push y publica en PyPI al crear un release en GitHub, usando Trusted Publishing (sin tokens en el repo):

  1. Sube la versión en pyproject.toml.
  2. Crea un release con el tag v<versión> (por ejemplo v1.8). El workflow verifica que coincidan.

Proyectos relacionados

Créditos

Desarrollado con fines educativos para el curso de Cloud Computing - UTEC.

Release files for utec-logger 1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for utec-logger 1.8
File Size Uploaded
utec_logger-1.8.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for utec-logger 1.8
File Interpreter ABI Platform
utec_logger-1.8-py3-none-any.whl Python 3 none any Details

Total release size: 11.5 kB

Release files / utec_logger-1.8.tar.gz

Download URL utec_logger-1.8.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c36b35d00e9f7870d609ddf10c868f11239ebde2e4547f7beffaa7d0c6dbf812
BLAKE2b-256 checksum
How to use checksums
015c0fbb0ecd4626571eccfec7150d74464941df5c6999ec16c9965acae3c301
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / utec_logger-1.8-py3-none-any.whl

Download URL utec_logger-1.8-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1c75bd2af699fc7a31ab2a0b78150a9069323fe8f8892d5e530c7419a33f75d
BLAKE2b-256 checksum
How to use checksums
139194a825f9166d7f43ac6fb91b4875f9afe7e263bd907ca8e79510eb7dac40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.8 This release

2 release files

1.7

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

3 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page