Log messages to a MongoDB collection
Project description
mongo_logger
A lightweight Python logger that writes messages to a MongoDB collection.
Installation
pip install 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(config_path="config.json", engine_name="my_app")
logger.z_log("Application started")
config_path— path to yourconfig.json(defaults toconfig.jsonin the script directory)engine_name— identifier for the logging source (defaults to the 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.0.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.0.tar.gz.
File metadata
- Download URL: z_mongo_logger-0.1.0.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 |
d81a2ec00aa6a1635fd616fda3a4d39f5b22deb560a12b65596a015b4ca69093
|
|
| MD5 |
90277b5a46756fd70ae8b80495f3562f
|
|
| BLAKE2b-256 |
7fb9cb08c1d3c1c5377f051dfc909883108e1b7091b1fdd7d8da9f34288d9077
|
File details
Details for the file z_mongo_logger-0.1.0-py3-none-any.whl.
File metadata
- Download URL: z_mongo_logger-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 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 |
700bbdfda55662a6984b7ccf585de3333ba4504ea5c36fe47b7127337c544e05
|
|
| MD5 |
9a1ebd8ae917c2024b66d3cd131a41f4
|
|
| BLAKE2b-256 |
92d9944689ad7b34018bcec83a2016b44bc89567aff3e5e1dab304bb08684e88
|