English description follows Japanese.
概要
ticklog は、関数の実行時間を簡単にロギングできる Python ライブラリです。関数にデコレータをつけるだけで、その実行時間を自動的に記録します。
- 軽量でシンプルな使い心地
llogライブラリを使用してjsonl形式でログ出力- デフォルトではカレントディレクトリに
ticklog.llogを自動生成 ticklog.setpath()を使えば出力先のファイルパス変更も可能
主に、関数単位のパフォーマンス測定や簡易プロファイリングに適しています。
インストール
pip install ticklog
基本的な使い方
import time
import ticklog
@ticklog
def some_proc():
time.sleep(0.5)
@ticklog
def other_proc():
time.sleep(0.1)
some_proc()
other_proc()
some_proc()
このコードを実行すると、関数の実行時間が ticklog.llog というファイルに jsonl 形式で記録されます。関数が呼び出されるたびに、1行ずつログが追記されます。
ログの確認
最新のログを確認するには、以下のようにします:
ticklog.llog.tail(n = 3)
ログファイルの出力先を変更する
ticklog.setpath("other_path.llog")
以降のログ出力が other_path.llog に切り替わります。
Overview
ticklog is a minimalistic Python library for logging the execution time of functions. With just a simple decorator, you can measure and persist function runtimes in a structured format.
- Super-lightweight and clean
- Uses the llog library to write logs in
jsonlformat - By default, logs are saved to
ticklog.llogin the current directory - You can also set a custom path for log output using
ticklog.setpath()
This tool is especially suited for profiling and monitoring the performance of key functions during development or testing.
Installation
pip install ticklog
Basic Usage
import time
import ticklog
@ticklog
def some_proc():
time.sleep(0.5)
@ticklog
def other_proc():
time.sleep(0.1)
some_proc()
other_proc()
some_proc()
The above code will output the execution times of the decorated functions into a file named ticklog.llog (in JSONL format), using the llog logger.
Each time a decorated function is called, a log entry is appended.
Viewing Logs
To inspect the most recent log entries:
ticklog.llog.tail(n = 3)
Setting a Custom Log File Path
ticklog.setpath("other_path.llog")
This will redirect all future logs to the specified path.
Metadata
Release files for ticklog 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ticklog-0.1.0.tar.gz | 3.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ticklog-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 kB
Release files / ticklog-0.1.0.tar.gz
| Download URL | ticklog-0.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
234d3b55a236f638da55905d2b7bdcc71921472570c67e2d40f3a5f6e641f490
|
|
BLAKE2b-256 checksum How to use checksums |
f547989e9c9dbbda7cf776ce720a570819ce2f0703d2eff2b6b134b5c9585ab3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|
Release files / ticklog-0.1.0-py3-none-any.whl
| Download URL | ticklog-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be3243332890b58220ad0aaeda6beb0b0c34f90acd844fe0d85230828136272f
|
|
BLAKE2b-256 checksum How to use checksums |
3dd9767508ecaa8b3ff51d75e45c6092accab61e463317374d8625faaa916cf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|
Security for ticklog 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.