Skip to main content

A time logger for Python programs

Project description

timelogger: A stopwatch-like time logger for Python programs

It provides:
  • Tracking time spent throughout a program in a method similar to a stopwatch

  • Output via standard Python logger for simplicity

Original use case:
  • Python program containing many packages and modules

  • Needed ability to log time gaps in a centralized way.

    • e.g. time consumed for imports or function calls

Installation:
  • pip install timelogger

    (Tested for Python >=3.6.5 on Linux (Ubuntu) and Windows 7/10)

Usage:
  • short example:

    # Set up your root logger, or use logcontrol
    import logcontrol
    
    # Import the package
    import timelogger
    
    # Customize the package logger, if needed
    logcontrol.register_logger(timelogger.logger, "timelogger")
    logcontrol.set_level(logcontrol.DEBUG, group="timelogger")
    logcontrol.log_to_console(group="timelogger")
    
    # Add a start time with a relevant name
    timelogger.start("imports")
    
    # imports of other packages for example purposes
    import binascii
    import decimal
    import hashlib
    import requests
    
    # To log the time differential, set a stop time for the same name
    timelogger.stop("imports")
    
    # To set a specific log level for the time differential logs: (default is logging.INFO)
    timelogger.set_log_level(logcontrol.DEBUG)

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

timelogger-0.0.1.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

timelogger-0.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file timelogger-0.0.1.tar.gz.

File metadata

  • Download URL: timelogger-0.0.1.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

File hashes

Hashes for timelogger-0.0.1.tar.gz
Algorithm Hash digest
SHA256 de41049d469bc3b38c098bb677842aabb6b5907f22a88860c1fbb10ea0187f2b
MD5 6b49f412df54d7b5091cafd215f45a26
BLAKE2b-256 faaf0b1eb0f87a7afc57cb188858da3a9c06923c3ea0901619a8761195aa6466

See more details on using hashes here.

File details

Details for the file timelogger-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: timelogger-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

File hashes

Hashes for timelogger-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2b6ce6050107a75e9b9a1d8842830e5fcbfbc4d58dcef5632414b1eafe7fa9b
MD5 de19941bbb9ffedb5e2db9d683ef5f74
BLAKE2b-256 34ad4b68d5781a7411607c8bb49b42e63ce7b9a5b0e2a117c3a4fda809449e96

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