Metadata-Version: 2.4
Name: pyfunclog
Version: 2.0.1
Summary: Comprehensive function logging with async support and sensitive data protection
Author-email: sobhan zadehali <sobhan.za47@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/sobhanzadehali/pyfunclog
Project-URL: Documentation, https://github.com/sobhanzadehali/pyfunclog#readme
Project-URL: Repository, https://github.com/sobhanzadehali/pyfunclog
Project-URL: Issues, https://github.com/sobhanzadehali/pyfunclog/issues
Keywords: logging,debugging,security,async,fastapi,sensitive-data
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Logging
Classifier: Topic :: Utilities
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: fastapi
Requires-Dist: fastapi>=0.68.0; extra == "fastapi"
Requires-Dist: starlette>=0.14.0; extra == "fastapi"
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov>=2.0; extra == "dev"
Requires-Dist: black>=22.0; extra == "dev"
Requires-Dist: isort>=5.0; extra == "dev"
Requires-Dist: flake8>=4.0; extra == "dev"
Dynamic: license-file

# 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"
)
```
