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.3.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.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: z_mongo_logger-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 e689f2967ca0adf41ee267e9075bde5e1b9aef86cdf7bd0292ecf8653c3bb0ce
MD5 338ea3e59a1e25cf78bc9f1c43d14b4a
BLAKE2b-256 ae5f8dec03dca76cb2246bdf07fbc31671d18bf702e90577e5f241e1d03c9656

See more details on using hashes here.

File details

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

File metadata

  • Download URL: z_mongo_logger-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 446ba97b8d70e903f5235a2187d762184dd36491768acc6997de006d5cd5a713
MD5 099e424caf3e6084b9a18b10c2a4e93d
BLAKE2b-256 4c9300cc25ccafd645c1666e2acbfd2913ee9d26b79aa1b528cca7f1eca3ec15

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