Log messages to a MongoDB collection
Project description
mongo_logger
A lightweight Python logger that writes messages to a MongoDB collection.
Installation
pip install z_mongo_logger
Configuration
Create a config.json file with your MongoDB connection details:
{
"LogConfig": {
"Log_Mongo_Connection": "mongodb://localhost:27017",
"Log_Database": "logs_db",
"Log_Collection": "logs"
}
}
Usage
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
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
z_mongo_logger-0.1.2.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file z_mongo_logger-0.1.2.tar.gz.
File metadata
- Download URL: z_mongo_logger-0.1.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0beef4a8324b4036dc011480ba369878f0dfbe0c926845c6ab996840d6056ab0
|
|
| MD5 |
5dc3c1b45901995e8cab0fd09efec3b4
|
|
| BLAKE2b-256 |
e61544e79a7cd0ff09f4ab53942065d95f7f0f881d06c28ff29275e310ffb766
|
File details
Details for the file z_mongo_logger-0.1.2-py3-none-any.whl.
File metadata
- Download URL: z_mongo_logger-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35584f6893164e7efce57c6acfb0b8a21127b6e43fc29dd7fe64a00ee92e0b32
|
|
| MD5 |
c954ac51bf3d545dade8b705bcb8672a
|
|
| BLAKE2b-256 |
8fe10476ffb25ff8e063e6a0bd40b9f53e346d00f8670094a9a5a6731a10effc
|