| Name | MT-PY-PerformanceLogging-Ver1 JSON |
| Version |
0.0.1
JSON |
| download |
| home_page | |
| Summary | A Mouritech package |
| upload_time | 2023-09-06 10:00:13 |
| maintainer | |
| docs_url | None |
| author | |
| requires_python | >=3.7 |
| license | |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# This is Moruitech_LoggingPerformance Package
# Project Title
Creating custom package for Logging Performance in python.
This is the project ,Whenever you need to check the performance of the code like time taken by the code to perform some task .
## Technologie
Python
## Installation
Install my-project with Python
INstall Mouritech__LoggingPerformance
```bash
pip install MT-PY-PerformanceLogging-Ver1==0.0.1
cd MT-PY-PerformanceLogging-Ver1==0.0.1
```
## Steps
```py
from Mouritech_LoggingPerformance.LogPerformance import PerformanceLogger
logger = PerformanceLogger(__name__)
PerformanceLogger(
)
```
## Authors
- [@Sirisha](https://www.github.com/octokatherine)
## License
[MIT](https://choosealicense.com/licenses/mit/)
[](https://choosealicense.com/licenses/mit/)
[](https://opensource.org/licenses/)
[](http://www.gnu.org/licenses/agpl-3.0)
## Used By
This project is used by the following Cases:
- Projects :-Logging Performance for checking the Time duration taken by the code to Excute Task/program .
-
```py
from Mouritech_LoggingPerformance.LogPerformance import PerformanceLogger
logger = PerformanceLogger(__name__)
PerformanceLogger(
)
```
### Receiver Example
# test code for our package
```py
from Mouritech_LoggingPerformance.LogPerformance import PerformanceLogger
import datetime
import time
import logging
# Create an instance of PerformanceLogger
logger = PerformanceLogger(__name__)
logging.basicConfig(level=logging.INFO,filename='normfunction.log' ,format='%(asctime)s - %(levelname)s - %(message)s')
# Use the logger to measure function performance
@logger.log_performance
# example code to check the loggingperformance
# Diasum number =175
# Disarum Number = 1¹ + 7² + 5³ = 1 + 49 + 125= 175
# each digit is added with incrementation in power and the addition of the powered value should be equal to actual input
def my_function():
start_time = time.time()
current_time = datetime.datetime.now()
num=int(input('Enter Num value:'))
result=0
power=1
for x in str(num):
y=int(x)
result= result + y**power
power=power+1
if num==result:
print(f'The provide {num} is Disarum')
else:
print(f'The Provided {num} is Not a Disarum Number')
# time sleep function is used to add delay in the execution of a program
duration_to_add = datetime.timedelta(hours=0, minutes=1)
# # Estimate the end time by adding the duration to the current time
ended_time = current_time + duration_to_add
end_time = time.time()
elapsed_time = end_time - start_time
logging.info(f'Code execution completed. Elapsed time: started at {current_time} {(start_time *10**3):.4f} ended at {ended_time} {(end_time *10**3):.4f} = {elapsed_time:.4f} seconds')
# Call the function
my_function()
```
#### Example:- 2
```py
import time
import logging
# Create an instance of PerformanceLogger
logger = PerformanceLogger(__name__)
logging.basicConfig(level=logging.INFO, filename='decoresult.log', format='%(asctime)s - %(levelname)s - %(message)s')
def outer_addition(func): #wrapped function
@logger.log_performance
def inner_addition(a, b):
start_time = time.time()
print("I'm in addition")
sum_result = a + b
print("Sum of", a, "and", b, "is", sum_result)
print("Returning addition")
func(sum_result, a)
end_time = time.time()
elapsed_time = end_time - start_time
logging.info(f'Addition execution completed. Elapsed time: {elapsed_time} seconds')
return inner_addition
def outer_subtraction(func): #wrapped function
@logger.log_performance
def inner_substarction(a, b):
start_time = time.time()
print("I'm in subtraction")
subtraction_result = a - b
print("Subtraction of", a, "and", b, "is", subtraction_result)
print("Returning subtraction")
func(a, b)
end_time = time.time()
elapsed_time = end_time - start_time
logging.info(f'Subtraction execution completed. Elapsed time: {elapsed_time} seconds')
return inner_substarction
@logger.log_performance
@outer_addition
@logger.log_performance
@outer_subtraction
def mOperations(a, b):
start_time = time.time()
print("I'm in mOperations")
print("mOperations execution completed")
end_time = time.time()
elapsed_time = end_time - start_time
logging.info(f'mOperations execution completed. Elapsed time: {elapsed_time} seconds')
mOperations(15, 10)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "MT-PY-PerformanceLogging-Ver1",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "",
"author_email": "Sirisha <siriteju343@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c1/43/c6802bd3bf6e00b17e03a2b56933d35e58d56055c38911b3889c2f05039c/MT_PY_PerformanceLogging_Ver1-0.0.1.tar.gz",
"platform": null,
"description": "# This is Moruitech_LoggingPerformance Package\r\n\r\n# Project Title\r\n\r\nCreating custom package for Logging Performance in python.\r\nThis is the project ,Whenever you need to check the performance of the code like time taken by the code to perform some task . \r\n\r\n\r\n\r\n\r\n\r\n## Technologie \r\nPython\r\n\r\n\r\n\r\n## Installation\r\n\r\nInstall my-project with Python\r\nINstall Mouritech__LoggingPerformance\r\n\r\n```bash\r\n pip install MT-PY-PerformanceLogging-Ver1==0.0.1\r\n cd MT-PY-PerformanceLogging-Ver1==0.0.1\r\n```\r\n\r\n\r\n\r\n## Steps \r\n```py\r\n\r\n\r\nfrom Mouritech_LoggingPerformance.LogPerformance import PerformanceLogger\r\nlogger = PerformanceLogger(__name__)\r\n\r\nPerformanceLogger(\r\n\r\n)\r\n\r\n```\r\n\r\n\r\n## Authors\r\n\r\n- [@Sirisha](https://www.github.com/octokatherine)\r\n\r\n\r\n## License\r\n\r\n[MIT](https://choosealicense.com/licenses/mit/)\r\n\r\n[](https://choosealicense.com/licenses/mit/)\r\n[](https://opensource.org/licenses/)\r\n[](http://www.gnu.org/licenses/agpl-3.0)\r\n\r\n\r\n\r\n## Used By\r\n\r\nThis project is used by the following Cases:\r\n\r\n- Projects :-Logging Performance for checking the Time duration taken by the code to Excute Task/program .\r\n- \r\n\r\n\r\n\r\n\r\n```py\r\n\r\n\r\n\r\nfrom Mouritech_LoggingPerformance.LogPerformance import PerformanceLogger\r\nlogger = PerformanceLogger(__name__)\r\n\r\nPerformanceLogger(\r\n\u00a0 \r\n)\r\n```\r\n### Receiver Example \r\n# test code for our package \r\n\r\n```py\r\nfrom Mouritech_LoggingPerformance.LogPerformance import PerformanceLogger\r\n\r\nimport datetime\r\nimport time\r\n\r\nimport logging\r\n# Create an instance of PerformanceLogger\r\nlogger = PerformanceLogger(__name__)\r\nlogging.basicConfig(level=logging.INFO,filename='normfunction.log' ,format='%(asctime)s - %(levelname)s - %(message)s')\r\n\r\n# Use the logger to measure function performance\r\n@logger.log_performance\r\n# example code to check the loggingperformance \r\n# Diasum number =175\r\n# Disarum Number = 1\u00b9 + 7\u00b2 + 5\u00b3 = 1 + 49 + 125= 175\r\n# each digit is added with incrementation in power and the addition of the powered value should be equal to actual input\r\ndef my_function():\r\n start_time = time.time()\r\n\r\n current_time = datetime.datetime.now()\r\n\r\n num=int(input('Enter Num value:'))\r\n\r\n result=0\r\n\r\n power=1\r\n\r\n for x in str(num):\r\n\r\n y=int(x)\r\n\r\n result= result + y**power\r\n\r\n power=power+1\r\n\r\n if num==result:\r\n\r\n print(f'The provide {num} is Disarum')\r\n\r\n else:\r\n\r\n print(f'The Provided {num} is Not a Disarum Number')\r\n\r\n # time sleep function is used to add delay in the execution of a program\r\n\r\n duration_to_add = datetime.timedelta(hours=0, minutes=1)\r\n\r\n# # Estimate the end time by adding the duration to the current time\r\n\r\n ended_time = current_time + duration_to_add\r\n end_time = time.time()\r\n elapsed_time = end_time - start_time\r\n logging.info(f'Code execution completed. Elapsed time: started at {current_time} {(start_time *10**3):.4f} ended at {ended_time} {(end_time *10**3):.4f} = {elapsed_time:.4f} seconds')\r\n\r\n# Call the function\r\n\r\nmy_function()\r\n\r\n```\r\n#### Example:- 2\r\n```py\r\n\r\nimport time\r\nimport logging\r\n# Create an instance of PerformanceLogger\r\nlogger = PerformanceLogger(__name__)\r\nlogging.basicConfig(level=logging.INFO, filename='decoresult.log', format='%(asctime)s - %(levelname)s - %(message)s')\r\ndef outer_addition(func): #wrapped function\r\n @logger.log_performance\r\n def inner_addition(a, b):\r\n start_time = time.time()\r\n print(\"I'm in addition\")\r\n sum_result = a + b\r\n print(\"Sum of\", a, \"and\", b, \"is\", sum_result)\r\n print(\"Returning addition\")\r\n func(sum_result, a)\r\n end_time = time.time()\r\n elapsed_time = end_time - start_time\r\n logging.info(f'Addition execution completed. Elapsed time: {elapsed_time} seconds')\r\n return inner_addition\r\ndef outer_subtraction(func): #wrapped function\r\n @logger.log_performance\r\n def inner_substarction(a, b):\r\n start_time = time.time()\r\n print(\"I'm in subtraction\")\r\n subtraction_result = a - b\r\n print(\"Subtraction of\", a, \"and\", b, \"is\", subtraction_result)\r\n print(\"Returning subtraction\")\r\n func(a, b)\r\n end_time = time.time()\r\n elapsed_time = end_time - start_time\r\n logging.info(f'Subtraction execution completed. Elapsed time: {elapsed_time} seconds')\r\n return inner_substarction\r\n@logger.log_performance\r\n@outer_addition\r\n@logger.log_performance\r\n@outer_subtraction\r\ndef mOperations(a, b):\r\n start_time = time.time()\r\n print(\"I'm in mOperations\")\r\n print(\"mOperations execution completed\")\r\n end_time = time.time()\r\n elapsed_time = end_time - start_time\r\n logging.info(f'mOperations execution completed. Elapsed time: {elapsed_time} seconds')\r\nmOperations(15, 10)\r\n```\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A Mouritech package",
"version": "0.0.1",
"project_urls": {
"Bug Tracker": "https://github.com/pypa/sampleproject/issues",
"Homepage": "https://github.com/pypa/sampleproject"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0dec4ec250cc99572a3d82a77331e9ecf823751e7bd92e7c56786aac804e551c",
"md5": "f3995afc0726e691a647948a9a6c0560",
"sha256": "8ad1945412ca08010e73f25275f26860f0135a949090dd5ae2a96886ace70d2c"
},
"downloads": -1,
"filename": "MT_PY_PerformanceLogging_Ver1-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f3995afc0726e691a647948a9a6c0560",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 6139,
"upload_time": "2023-09-06T10:00:11",
"upload_time_iso_8601": "2023-09-06T10:00:11.459483Z",
"url": "https://files.pythonhosted.org/packages/0d/ec/4ec250cc99572a3d82a77331e9ecf823751e7bd92e7c56786aac804e551c/MT_PY_PerformanceLogging_Ver1-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c143c6802bd3bf6e00b17e03a2b56933d35e58d56055c38911b3889c2f05039c",
"md5": "5a0ae867d8a38d4dc36cf489cd4d27eb",
"sha256": "7a3d0e4985269fa06c434622bb11813a7f8c396f343e386b91cf2e792136e178"
},
"downloads": -1,
"filename": "MT_PY_PerformanceLogging_Ver1-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "5a0ae867d8a38d4dc36cf489cd4d27eb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4355,
"upload_time": "2023-09-06T10:00:13",
"upload_time_iso_8601": "2023-09-06T10:00:13.877332Z",
"url": "https://files.pythonhosted.org/packages/c1/43/c6802bd3bf6e00b17e03a2b56933d35e58d56055c38911b3889c2f05039c/MT_PY_PerformanceLogging_Ver1-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-06 10:00:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pypa",
"github_project": "sampleproject",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "mt-py-performancelogging-ver1"
}