Skip to main content

ot-logging-helpers

This python package provides logging helpers that are used in Orthanc Team projects.

Demo

from ot_logging_helpers import LogContext, configure_logging
import logging
import threading

configure_logging()

with LogContext("1ST"):
    logging.info("my first message")
    with LogContext("2ND"):
        logging.info("my second message")


def worker(worker_id):
    with LogContext(f"Worker {worker_id}"):
        logging.info("my top level worker message")

        with LogContext("next-context"):
            logging.warning("my warning")

for i in range(0, 2):
    thread = threading.Thread(target=worker, args=(i+1, ))
    thread.start()


###### this shall output 
# 2024-04-05 15:05:28,162 - root       - INFO     -  1ST | my first message
# 2024-04-05 15:05:28,162 - root       - INFO     -  1ST | 2ND | my second message
# 2024-04-05 15:05:28,163 - root       - INFO     -  Worker 1 | my top level worker message
# 2024-04-05 15:05:28,163 - root       - WARNING  -  Worker 1 | next-context | my warning
# 2024-04-05 15:05:28,163 - root       - INFO     -  Worker 2 | my top level worker message
# 2024-04-05 15:05:28,163 - root       - WARNING  -  Worker 2 | next-context | my warning

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ot_logging_helpers-0.1.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

ot_logging_helpers-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file ot_logging_helpers-0.1.1.tar.gz.

File metadata

  • Download URL: ot_logging_helpers-0.1.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for ot_logging_helpers-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5aa72c09528500c4f6fc954fea4e08ebce345d6a4f6e86f9ab55883a5b6da8a2
MD5 b928026cb4f18d7797b7c269b2a36fc7
BLAKE2b-256 1f2d6b6472c294db4433cae65f587d9d98f985159e811b2734ac1b0e45de434d

See more details on using hashes here.

File details

Details for the file ot_logging_helpers-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ot_logging_helpers-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9129a18427a1fd14a1b98e6b10594a70d3bc647f0fa45314394b3f1d4e6f9e6
MD5 cf30540ec57fbc5b40b5e1d10baa6503
BLAKE2b-256 ad93734395e0dff882f859c0d71b0a5cbb4392b76c0a58bdffa751bebd57eb1f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

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