Skip to main content

Core utilities for UnifyOps Python projects

Project description

UnifyOps Core

Core utilities for UnifyOps Python projects. This package provides shared functionality that can be used across all UnifyOps Python applications.

Features

  • Logging: Standardized logging configuration with JSON support
  • Exceptions: Common exception classes with proper HTTP status code mapping

Installation

pip install unifyops-core

Usage

Logging

from unifyops_core.logging import get_logger

# Create a standard logger
logger = get_logger("my_app")
logger.info("This is a log message")

# Create a JSON logger
json_logger = get_logger("my_app.json", json_format=True)
json_logger.info("This is a structured log", extra={"props": {"user_id": "123", "action": "login"}})

# Log with context
from unifyops_core.logging import log_with_context
log_with_context(logger, logger.INFO, "User logged in", user_id="123", action="login")

Exceptions

from unifyops_core.exceptions import NotFoundError, ValidationError

# Raise standard exceptions
raise NotFoundError("User not found")
raise ValidationError("Invalid email format", details={"email": "Invalid format"})

# Custom exception with details
from unifyops_core.exceptions import UnifyOpsException
raise UnifyOpsException(
    message="Payment processing failed",
    code="PAYMENT_ERROR",
    status_code=400,
    details={"payment_id": "123", "reason": "Insufficient funds"}
)

License

This project is licensed under the MIT License.

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

unifyops_core-0.10.6.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

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

unifyops_core-0.10.6-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

Details for the file unifyops_core-0.10.6.tar.gz.

File metadata

  • Download URL: unifyops_core-0.10.6.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for unifyops_core-0.10.6.tar.gz
Algorithm Hash digest
SHA256 29b094823d86cebde4f46b953bf6fef11d1f747ca052a5bbe21a79fe119c69e9
MD5 8ce1af4512108eddb80aa8e1a1b92133
BLAKE2b-256 c75bfb78c3e8898df911634b499cd04285419fba3349c25dc1043d1ce9b98043

See more details on using hashes here.

File details

Details for the file unifyops_core-0.10.6-py3-none-any.whl.

File metadata

  • Download URL: unifyops_core-0.10.6-py3-none-any.whl
  • Upload date:
  • Size: 39.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for unifyops_core-0.10.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f138a262d5c072e4dbc7bb4b29f1d9de4500de7055a69fd89774027b9fea5b61
MD5 64ef13ead1dd689c715938be69ae5651
BLAKE2b-256 8a9570932073fd5b5da93f8e33ab4fb906eef53b2fe251355423e7db8fcc657d

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