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.5.0.tar.gz (28.9 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.5.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: unifyops_core-0.5.0.tar.gz
  • Upload date:
  • Size: 28.9 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.5.0.tar.gz
Algorithm Hash digest
SHA256 26c0efa5a2ebf2054d0dba5626f31e9f1bd4660bb85be056f345b4389a88d0de
MD5 4232193ca689df27af8396a53a9bec06
BLAKE2b-256 2d72f160d7fd6c1f2f7e23b8bebf6b71a0b6fc67e2a3c810b91840ab3bc19d63

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unifyops_core-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 35.8 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d26884ce2662380cfa4f74f88cd63426d05d0cc866aa89480fca36e35e3e9f2f
MD5 e7278c761a1bb2ec9ad6e1689c675a1e
BLAKE2b-256 4179dd1253e8e89badff70caead97b779ee707e8a24cb732b43e14e48c13fc4b

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