Skip to main content

This project provides a simple way to profile the execution time of your Python functions.

Project description

Time Logger

This project provides a simple way to profile the execution time of your Python functions.

Features

  • Measure the execution time of functions with the @profiling decorator.
  • Optionally log the start and end times of function execution.
  • Log specific variables or all arguments passed to the function.
  • Choose between using the standard print function or a custom logger for output.

Installation

pip install pytime-logger

Usage

from time_logger import profiling

# Basic usage
@profiling()
def my_function():
    # Your code here

# Log start and end times
@profiling(log_start=True)
def my_function():
    # Your code here

# Log specific variables
@profiling(log_variables=['my_variable'])
def my_function(my_variable):
    # Your code here

# Log all arguments
@profiling(log_all_args=True)
def my_function(arg1, arg2):
    # Your code here

# Use a custom logger
import logging

logger = logging.getLogger(__name__)
handler = logging.StreamHandler()
logger.addHandler(handler)

@profiling(logger=logger)
def my_function():
    # Your code here

Examples

See the run_examples.py file for more examples.

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

pytime-logger-0.0.4.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

pytime_logger-0.0.4-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pytime-logger-0.0.4.tar.gz.

File metadata

  • Download URL: pytime-logger-0.0.4.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for pytime-logger-0.0.4.tar.gz
Algorithm Hash digest
SHA256 4c389b4ecfab20f572e58ba8d213bd601f026909e055e24a9957368a69e99718
MD5 0f2e38245cfda3df069c8623cb6ff093
BLAKE2b-256 d28ca9cc0abd0000f9ea9eee38e553bbbaed12a4faef32d1258d72ed03019b2c

See more details on using hashes here.

File details

Details for the file pytime_logger-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pytime_logger-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.17

File hashes

Hashes for pytime_logger-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2030ca8af2ed8534a1ff4ecbf95034c132704228e7fbf7b20b112a18f8775c70
MD5 bafc7a933d6411e8800294c9bac4857d
BLAKE2b-256 4ee625f5cf3f586bbd37bb08aca68e99e38112420089e52cff2fe59b6c4f190a

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