Simple logging and benckmark decorator
Project description
Kami Logging
Simple decorator to logging and benchmark functions
📝 Table of Contents
🧐 About
This package arose from the need to simplify the logging tasks of applications created by the Kami CO software development team.
Currently the package has 4 decorators: benchmark_with, logging_with, default_logging and default_benchmark for logging and basic performance testing with or without a defined logger object;
🏁 Getting Started
These instructions will get you a copy of the package and a daily use example.
Prerequisites
- Python 3.x
- logging library
Installing
$pip install kami-logging
🎈 Usage
The four decorators available are:
-
@logging_with: generates a log message of type info at the beginning and end of the function execution, using a logger object defined by the developer
-
@default_logging: generates a log message of type info at the beginning and end of function execution, using a default logger object named 'default'
-
@benchmark_with: Generates a log message of type info with the runtime of the function accurate to 3 decimal places, using a developer-defined logger object
-
@default_benchmark: generates a log message of type info with the runtime of the function accurate to 3 decimal places, using a default logger object named 'default'
import logging
from kami_logging import logging_with, benchmark_with
my_app_logger = logging.getLogger("my_app")
@benchmark_with(my_app_logger)
@logging_with(my_app_logger)
def my_func(*args, **kwargs):
pass
Result:
⛏️ Built Using
✍️ Authors
- @maicondmenezes - Idea & Initial work
See also the list of contributors who participated in this project.
🎉 Acknowledgements
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
Hashes for kami_logging-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ac4b7545e5969d745db2aa2311239ca3b20da3d05157c7e24670cf5b9406027 |
|
MD5 | 01f206fb5492889e4dfa1e239fe89203 |
|
BLAKE2b-256 | 20f9e1d139877a77089cc6e370f5762f0d5854354b9320b22645b1d1ff34876b |