pyfunclog


Namepyfunclog JSON
Version 2.0.1 PyPI version JSON
download
home_pageNone
SummaryComprehensive function logging with async support and sensitive data protection
upload_time2025-11-12 06:24:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords logging debugging security async fastapi sensitive-data
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyFuncLog

Comprehensive function logging with automatic sensitive data protection.

## Features

- 🕵️‍♂️ **Automatic Variable Capture**: Captures all local variables and function arguments
- 🔒 **Sensitive Data Protection**: Automatically masks passwords, tokens, API keys, etc.
- 🎯 **Flexible Decorators**: Choose what to log - everything, returns, or just locals
- 📝 **Structured Logging**: JSON-formatted logs with clear structure
- 🚀 **Easy Integration**: Simple decorator-based approach

## Installation

```bash
pip install pyfunclog
```

## usage example:
```python
import asyncio
from pyfunclog import async_secure_log_function

@async_secure_log_function()
async def fetch_data(api_key: str, user_id: int):
    # api_key will be automatically masked
    await asyncio.sleep(0.1)
    result = {"user_id": user_id, "data": "sample"}
    return result

# Or use universal decorator for both sync and async
from pyfunclog import universal_log

@universal_log
async def async_function(x):
    return x * 2

@universal_log
def sync_function(x):
    return x * 2
```

## fastapi integration
```python
from fastapi import FastAPI
from pyfunclog import FastAPILoggingSupport, async_secure_log_function

app = FastAPI()
logging_support = FastAPILoggingSupport()
logging_support.middleware(app)  # Add request/response logging

@app.get("/users/{user_id}")
@async_secure_log_function()
async def get_user(user_id: int, token: str):
    # token will be automatically masked
    return {"user_id": user_id, "name": "John Doe"}
```

## configure logging
```python
from pyfunclog import configure_logging

# Configure logging
configure_logging(
    level="DEBUG",
    format_string='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
    filename="app.log"
)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyfunclog",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "logging, debugging, security, async, fastapi, sensitive-data",
    "author": null,
    "author_email": "sobhan zadehali <sobhan.za47@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/15/7f/4d5fa178459c1b89374026f74530981eebba3e06ae1d4307414996dce57a/pyfunclog-2.0.1.tar.gz",
    "platform": null,
    "description": "# PyFuncLog\n\nComprehensive function logging with automatic sensitive data protection.\n\n## Features\n\n- \ud83d\udd75\ufe0f\u200d\u2642\ufe0f **Automatic Variable Capture**: Captures all local variables and function arguments\n- \ud83d\udd12 **Sensitive Data Protection**: Automatically masks passwords, tokens, API keys, etc.\n- \ud83c\udfaf **Flexible Decorators**: Choose what to log - everything, returns, or just locals\n- \ud83d\udcdd **Structured Logging**: JSON-formatted logs with clear structure\n- \ud83d\ude80 **Easy Integration**: Simple decorator-based approach\n\n## Installation\n\n```bash\npip install pyfunclog\n```\n\n## usage example:\n```python\nimport asyncio\nfrom pyfunclog import async_secure_log_function\n\n@async_secure_log_function()\nasync def fetch_data(api_key: str, user_id: int):\n    # api_key will be automatically masked\n    await asyncio.sleep(0.1)\n    result = {\"user_id\": user_id, \"data\": \"sample\"}\n    return result\n\n# Or use universal decorator for both sync and async\nfrom pyfunclog import universal_log\n\n@universal_log\nasync def async_function(x):\n    return x * 2\n\n@universal_log\ndef sync_function(x):\n    return x * 2\n```\n\n## fastapi integration\n```python\nfrom fastapi import FastAPI\nfrom pyfunclog import FastAPILoggingSupport, async_secure_log_function\n\napp = FastAPI()\nlogging_support = FastAPILoggingSupport()\nlogging_support.middleware(app)  # Add request/response logging\n\n@app.get(\"/users/{user_id}\")\n@async_secure_log_function()\nasync def get_user(user_id: int, token: str):\n    # token will be automatically masked\n    return {\"user_id\": user_id, \"name\": \"John Doe\"}\n```\n\n## configure logging\n```python\nfrom pyfunclog import configure_logging\n\n# Configure logging\nconfigure_logging(\n    level=\"DEBUG\",\n    format_string='%(asctime)s - %(name)s - %(levelname)s - %(message)s',\n    filename=\"app.log\"\n)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Comprehensive function logging with async support and sensitive data protection",
    "version": "2.0.1",
    "project_urls": {
        "Documentation": "https://github.com/sobhanzadehali/pyfunclog#readme",
        "Homepage": "https://github.com/sobhanzadehali/pyfunclog",
        "Issues": "https://github.com/sobhanzadehali/pyfunclog/issues",
        "Repository": "https://github.com/sobhanzadehali/pyfunclog"
    },
    "split_keywords": [
        "logging",
        " debugging",
        " security",
        " async",
        " fastapi",
        " sensitive-data"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9a33f5d645394ba48e87c9c99202e7f6d4d194e973c59592061fc205e9b25e0e",
                "md5": "dcc8add98f4e0ed0e48537ac6cf3d966",
                "sha256": "81d5a522095216be64765e38e62a1f7ab362a10df82b85f4aee4e61ad1807b52"
            },
            "downloads": -1,
            "filename": "pyfunclog-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dcc8add98f4e0ed0e48537ac6cf3d966",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11243,
            "upload_time": "2025-11-12T06:24:28",
            "upload_time_iso_8601": "2025-11-12T06:24:28.490454Z",
            "url": "https://files.pythonhosted.org/packages/9a/33/f5d645394ba48e87c9c99202e7f6d4d194e973c59592061fc205e9b25e0e/pyfunclog-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "157f4d5fa178459c1b89374026f74530981eebba3e06ae1d4307414996dce57a",
                "md5": "37500dabcff5f0152e644b8bea241efe",
                "sha256": "bfbb92946a0bc1dac710ea14a2dec842af7a7db3822e54fc9a1d8230800e963e"
            },
            "downloads": -1,
            "filename": "pyfunclog-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "37500dabcff5f0152e644b8bea241efe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 12232,
            "upload_time": "2025-11-12T06:24:29",
            "upload_time_iso_8601": "2025-11-12T06:24:29.728266Z",
            "url": "https://files.pythonhosted.org/packages/15/7f/4d5fa178459c1b89374026f74530981eebba3e06ae1d4307414996dce57a/pyfunclog-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-12 06:24:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sobhanzadehali",
    "github_project": "pyfunclog#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyfunclog"
}
        
Elapsed time: 0.49004s