Skip to main content

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 your config.json (defaults to config.json in 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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

z_mongo_logger-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

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

Hashes for z_mongo_logger-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d81a2ec00aa6a1635fd616fda3a4d39f5b22deb560a12b65596a015b4ca69093
MD5 90277b5a46756fd70ae8b80495f3562f
BLAKE2b-256 7fb9cb08c1d3c1c5377f051dfc909883108e1b7091b1fdd7d8da9f34288d9077

See more details on using hashes here.

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

Hashes for z_mongo_logger-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 700bbdfda55662a6984b7ccf585de3333ba4504ea5c36fe47b7127337c544e05
MD5 9a1ebd8ae917c2024b66d3cd131a41f4
BLAKE2b-256 92d9944689ad7b34018bcec83a2016b44bc89567aff3e5e1dab304bb08684e88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page