Simple logging profiler.
Project description
logprof - Simple logging profiler
Simple logging of timing and memory usage with decorator or context manager.
Installation
pip install logprof
Usage
Below is an example usage
import logging
from logprof import logprof
logging.basicConfig(level="INFO")
# tf can be seconds (default) or "full"
@logprof("bar", tf="breakdown")
def function():
print("The bit in the middle")
function()
# INFO:logprof:>>> 'bar' started..
# The bit in the middle
# INFO:logprof:<<< 'bar' finished. Took 15us 860ns
class Foo:
@logprof("class func", tf="nanoseconds")
def bar(self, x=1):
print(f"bar got x = {x}")
Foo().bar()
# INFO:logprof:>>> 'class func' started..
# bar got x = 1
# INFO:logprof:<<< 'class func' finished. Took 15339ns
with logprof("foo", tf="breakdown", mf="breakdown"):
from time import sleep
sleep(1)
x = [1] * 2**25 ## 256MB?
x.append(1000)
print("The bit in the middle")
# INFO:logprof:>>> 'foo' started..
# The bit in the middle
# INFO:logprof:<<< 'foo' finished. Took 1s 111ms 947us 614ns. Used 255mib 1004kib.
Development
Before commit run following format commands in project folder:
nox --session do-lint
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logprof-0.1.1.tar.gz.
File metadata
- Download URL: logprof-0.1.1.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b79352754e615e68a509e2ea793b3c39b2233168518b8759af55fbdc6c610c9
|
|
| MD5 |
f54e1c2fb5b28603ac349d1108cd68a4
|
|
| BLAKE2b-256 |
2417eddc56b99d49cd743b5e3b0d486e4af573b20c39141a25bd8d74d035f8a5
|
Provenance
The following attestation bundles were made for logprof-0.1.1.tar.gz:
Publisher:
release.yaml on bsdz/logprof
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logprof-0.1.1.tar.gz -
Subject digest:
9b79352754e615e68a509e2ea793b3c39b2233168518b8759af55fbdc6c610c9 - Sigstore transparency entry: 220089255
- Sigstore integration time:
-
Permalink:
bsdz/logprof@dcc787c347144942337eda9d18c62d1a943d1173 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bsdz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@dcc787c347144942337eda9d18c62d1a943d1173 -
Trigger Event:
release
-
Statement type:
File details
Details for the file logprof-0.1.1-py3-none-any.whl.
File metadata
- Download URL: logprof-0.1.1-py3-none-any.whl
- Upload date:
- Size: 1.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65ffed5a280e1956c6e9cd97cd8602d659c592ff68a6d6cb84d5a8fdb5ce509e
|
|
| MD5 |
cb50fbfc736b92e08812b64ac8fe0c40
|
|
| BLAKE2b-256 |
4c339d0868c646f698c476bf49b951c7366e3778db7fa9e6c781cafd63789a08
|
Provenance
The following attestation bundles were made for logprof-0.1.1-py3-none-any.whl:
Publisher:
release.yaml on bsdz/logprof
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logprof-0.1.1-py3-none-any.whl -
Subject digest:
65ffed5a280e1956c6e9cd97cd8602d659c592ff68a6d6cb84d5a8fdb5ce509e - Sigstore transparency entry: 220089258
- Sigstore integration time:
-
Permalink:
bsdz/logprof@dcc787c347144942337eda9d18c62d1a943d1173 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/bsdz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@dcc787c347144942337eda9d18c62d1a943d1173 -
Trigger Event:
release
-
Statement type: