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.3.tar.gz (31.0 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.3-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: unifyops_core-0.10.3.tar.gz
  • Upload date:
  • Size: 31.0 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.3.tar.gz
Algorithm Hash digest
SHA256 a56fefbdc4d11998bc1c237bfb20631634735fb00d97fd286cbacefccbbb76d7
MD5 184df6048b8bc713ab56c6fb1322e705
BLAKE2b-256 0e3802c1cda840a1e1d3c251e08b050e144407a53206920dd13e16f9a37a9501

See more details on using hashes here.

File details

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

File metadata

  • Download URL: unifyops_core-0.10.3-py3-none-any.whl
  • Upload date:
  • Size: 38.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0265819f6a5e0ac951698940c26d847bc96696be4335b59632032bf2e917c642
MD5 cf78350110da1f9c832e1b06206b03a0
BLAKE2b-256 e27960bdffbe54e7f4e415d3ad73e3f61308794339d709572af988bf59f7edd2

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