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 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.4.tar.gz (3.6 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.4-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file z_mongo_logger-0.1.4.tar.gz.

File metadata

  • Download URL: z_mongo_logger-0.1.4.tar.gz
  • Upload date:
  • Size: 3.6 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.4.tar.gz
Algorithm Hash digest
SHA256 ca2d8f473f7a8eed978482d1a322832941d821b9e4d6422cac84dc8dfc31b5ca
MD5 43e102fe112b0254463517c44cd78000
BLAKE2b-256 2035eba758bba750283d5fda8996e0c2bb6b2bc026b9dbb681395a0999b7a307

See more details on using hashes here.

File details

Details for the file z_mongo_logger-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: z_mongo_logger-0.1.4-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

Hashes for z_mongo_logger-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 63cd7840fd7b72aa5b685f50a7ec14493e678b35caab934c2ca3ae5d9c726302
MD5 27f975c374bd923964d7b9874820906a
BLAKE2b-256 93c56f95967532c1b83d02cb72d28d713613227ee2d05e93d9053649c16bd14c

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