Metadata-Version: 2.4
Name: z_mongo_logger
Version: 0.1.3
Summary: Log messages to a MongoDB collection
Author-email: Mohamed Amin <mohamedamin.tech@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/mohamedaminkhaled/python-topics/tree/main/problems/mongo_logger
Keywords: mongodb,logging,mongo
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pymongo<4.0,>=3.12
Dynamic: license-file

# mongo_logger

A lightweight Python logger that writes messages to a MongoDB collection.

## Installation

```bash
pip install z_mongo_logger
```

## Configuration

Create a `config.json` file with your MongoDB connection details:

```json
{
    "LogConfig": {
        "Log_Mongo_Connection": "mongodb://localhost:27017",
        "Log_Database": "logs_db",
        "Log_Collection": "logs"
    }
}
```

## Usage

```python
from mongo_logger import MongoLogger

logger = MongoLogger()
logger.z_log("Application started")
```

- `config_path` — auto-detected from the caller's directory (`config.json`)
- `engine_name` — auto-detected from the caller's parent folder name

## Document Schema

Each log entry is stored as a MongoDB document:

| Field         | Description                    |
|---------------|--------------------------------|
| `Engine_Name` | Name of the logging source     |
| `Status`      | The log message                |
| `Time`        | UTC timestamp of the log entry |

## License

MIT
