Skip to main content

The idea behind this package is possibility to you use some client or something like the Metabase for collect and analyse logs of your application.
Its return mongodb_id or None on exception case.

Its need two environments variables:

  • MONGO_DB
  • MONGO_URL

Its works with three collections:

  • error
  • info
  • critical

Arguments:

  • msg - Required
    • The message to log;
  • payload - Default is None
    • If need to log a payload that make a some request;
  • result - Default is None
    • If need to log a request result;
  • log_console - boolean default is True
    • Enable or disable log console view;
  • log_detail - boolean default is True
    • If disabled show only mongo_id and message.

Sample:

from mongo_system_log import *
log = LogThis(get_module_name())
log.info(msg="info message", payload="payload", result="result", log_console=False, log_detail=False)
log.error(msg="error message", payload="payload", result="result")
log.critical(msg="critical message", payload="payload", result="result")
log.custom(payload={"key": "value"}, collection='collection', msg_console="message on console")

get_module_name()

  • This function gets module and file name that called it. Must be called on instantiate the LogThis class.
    The arguments payload and result has default value None.

The document fields are:

  • Ip
  • HostName
  • App - File name that was executed;
  • ModuleCalled - Module name that methods where called;
  • Date - Date Time on format 2010-12-12 11:41:42,612;
  • Severity - INFO, ERROR or CRITICAL;
  • Message - The message that want to be logged;
  • Payload - A dict that used to call a request for example;
  • Result - A request result.

New method:

custom

Arguments:

  • payload - Required
    • A dict that will be sent to MongoDb;
  • collection - required
    • The collection that will receive the payload;
  • msg_console - Default is string empty
    • The message that will be displayed on the console. It will not be sent to MongoDb;
  • log_console - boolean default is True
    • Enable or disable log console view;
  • log_detail - boolean default is True
    • If disabled show only mongo_id and message.

I suggest that You use the Metabase:
https://www.metabase.com/

It is amazing to analyze logs.

Metadata

Release files for mongo-system-log 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mongo-system-log 0.1.6
File Size Uploaded Provenance Actions
mongo_system_log-0.1.6.tar.gz 15.9 kB Without provenance Details for mongo_system_log-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mongo-system-log 0.1.6
File Interpreter ABI Platform Actions
mongo_system_log-0.1.6-py3-none-any.whl Python 3 none any Details for mongo_system_log-0.1.6-py3-none-any.whl

Total release size: 32.6 kB

Release files / mongo_system_log-0.1.6.tar.gz

Download URL mongo_system_log-0.1.6.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
07caecbb3b0046c426f59e873afb8e7e0b09df4a2da3e18529b4b8c8c9176e02
BLAKE2b-256 checksum
How to use checksums
eaf04c49237c3d196bf9b7812512ff0bebf84edda926d97a2ead37eb5480fcdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.8.19

Release files / mongo_system_log-0.1.6-py3-none-any.whl

Download URL mongo_system_log-0.1.6-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e26a22404e9d74109a128ef2aafdbadbc3c5c58ab238e1257a1b342432e5f99
BLAKE2b-256 checksum
How to use checksums
4dbcea78212956baf570fa183b5a6f9ed3c042ad12d036f60cae71a26701143d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.8.19

Security for mongo-system-log 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page