============
IOLogger
============
Decorator which logs the wrapped function/method.
The following are logged:
1. name of the function called
2. arg(s) passed for the function called (if any)
3. kwarg(s) passed for the function called (if any)
4. execution time of the function called (in seconds)
* also catches and logs any **exceptions** raised *gracefully*.
**Quick Installation:**
``pip install iologger``
**Simply attach to your functions/methods:**
```
from iologger import iologger
@iologger
def sample_function(simple_arg: str, simple_kwarg: str='yes') -> str:
return simple_arg + " " + simple_kwarg
```
**Just setup your logging handler and it will start working:**
```
>>> from sys import stdout
...
... from logbook import StreamHandler
...
... stdout_handler = StreamHandler(stdout)
... stdout_handler.push_application()
...
>>> sample_function("test-string", simple_kwarg="no")
[2017-01-29 18:48:50.170606] DEBUG: IOL - sample_function: Starting...
[2017-01-29 18:48:50.171035] DEBUG: IOL - sample_function: passed args/kwargs = {'args': ('test-string',), 'kwargs': {'simple_kwarg': 'no'}}
[2017-01-29 18:48:50.171197] DEBUG: IOL - sample_function: returned: 'test-string no'
[2017-01-29 18:48:50.171319] INFO: IOL - sample_function: ...Finished (3.3e-06 seconds)
```
IOLogger
============
Decorator which logs the wrapped function/method.
The following are logged:
1. name of the function called
2. arg(s) passed for the function called (if any)
3. kwarg(s) passed for the function called (if any)
4. execution time of the function called (in seconds)
* also catches and logs any **exceptions** raised *gracefully*.
**Quick Installation:**
``pip install iologger``
**Simply attach to your functions/methods:**
```
from iologger import iologger
@iologger
def sample_function(simple_arg: str, simple_kwarg: str='yes') -> str:
return simple_arg + " " + simple_kwarg
```
**Just setup your logging handler and it will start working:**
```
>>> from sys import stdout
...
... from logbook import StreamHandler
...
... stdout_handler = StreamHandler(stdout)
... stdout_handler.push_application()
...
>>> sample_function("test-string", simple_kwarg="no")
[2017-01-29 18:48:50.170606] DEBUG: IOL - sample_function: Starting...
[2017-01-29 18:48:50.171035] DEBUG: IOL - sample_function: passed args/kwargs = {'args': ('test-string',), 'kwargs': {'simple_kwarg': 'no'}}
[2017-01-29 18:48:50.171197] DEBUG: IOL - sample_function: returned: 'test-string no'
[2017-01-29 18:48:50.171319] INFO: IOL - sample_function: ...Finished (3.3e-06 seconds)
```
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
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 iologger-1.0.6-py2.py3-none-any.whl.
File metadata
- Download URL: iologger-1.0.6-py2.py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2130c5f2a8b345d88a0808c1cd2e732e471ae5ef3edc7d7cbc6f166d5b06bb4b
|
|
| MD5 |
a4fb8437721dbdbae7c6462cda797453
|
|
| BLAKE2b-256 |
d5d6edd54221ace1ce66a8ecce4036ff63f52d92a33a5925af1605c3acd4f5c4
|