Skip to main content

Log Queue

Project description

logq

Log Queue

implement logq.get()

import logq
def log_worker():
    while True:
        log_dict = logq.get()
        if not log_dict:
            break
        print(log_dict)
    
thread = threading.Thread(target=log_worker)
thread.start()
# ...
# thread.join()

logging

logq.info("start")
logq.info("finish")
log_dict = logq.get()
print(log_dict)

output:
{'timestamp': 1700000000.100001, 'process_id': 1234, 'thread_id': 1234567890, 'log_type': 'information', 'file_name': 'test.py', 'file_lineno': 2, 'text': 'start'}
{'timestamp': 1700000000.100002, 'process_id': 1234, 'thread_id': 1234567890, 'log_type': 'information', 'file_name': 'test.py', 'file_lineno': 2, 'text': 'start'}

flush logq.get()

def log_worker():
    while True:
        log_dict = logq.get()
        if not log_dict:
            break
        print(log_dict)

    while not logq.empty():
        log_dict = logq.get()
        print(log_dict)
        
    print("flush queue")

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

logqueue-0.0.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

logqueue-0.0.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file logqueue-0.0.0.tar.gz.

File metadata

  • Download URL: logqueue-0.0.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for logqueue-0.0.0.tar.gz
Algorithm Hash digest
SHA256 f906ae63a16a4c57bf7d8b109426975c5afd11966a2bf00aed24e6999ff3486b
MD5 457a04ff24a65bc2cab6817e7b178e08
BLAKE2b-256 c9707821511179f8700d8bde1f1a89f6f746e00a42ea178e5932d4fb65f78f52

See more details on using hashes here.

File details

Details for the file logqueue-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: logqueue-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for logqueue-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6d0bee212b220b46d388e9ce470dd69fa53e70cce1015438512e22d3ffbe3cb
MD5 f0c1741e244889299948f4d3d78060fc
BLAKE2b-256 d029902fb618acaf3b1f3efde5276d92daf8826590fade7d043d99c2982a6a8c

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