crazylog-0.1.1
توضیحات
A Python package to add extensive logs to each execution statement
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | crazylog-0.1.1 |
| نام | crazylog |
| نسخه کتابخانه | 0.1.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Aaron Farntrog |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/afarntrog/crazylog |
| آدرس اینترنتی | https://pypi.org/project/crazylog/ |
| مجوز | MIT |
# crazylog
**crazylog** logs like crazy. Allows to add extensive logging at each step in the python execution cycle.
# Installation
You can install from pypi:
``` bash
pip install -U crazylog
```
Or get the latest updates (Not recommended for production):
```bash
pip install -U git+https://github.com/afarntrog/crazylog.git
```
# Quickstart
Here you can see a few samples to get a feel of whats ahead.
## Basic example
```python
from crazylog import CrazyLogger
def foo():
print('running code ...')
with CrazyLogger() as crazy:
foo()
```
## Run it for specific classes only
```python
class CustomClass:
pass
with CrazyLogger() as crazy:
crazy.exclusively = [CustomClass]
foo()
```
## Apply it manually to specific classes via metaclasses
#### Run the code as usual. `CrazyLogger` will kick in if that class is called
```python
from crazylog import CrazyLoggerMeta
class CustomClass(metaclass=CrazyLoggerMeta):
def printer(self):
print('CrazyLogger is active')
def foo():
print('CrazyLogger will do nothing')
CustomClass().printer()
# run as usual
foo()
```
## Apply it at the module level
#### `apply` should be added at the bottom of the module that you want it to take affect.
```python
# my_first_module.py
from crazylog import CrazyLogger
class CustomClass():
def printer(self):
print('CrazyLogger is active')
def foo():
print('CrazyLogger is active')
CustomClass().printer()
CrazyLogger.apply(__name__)
# my_second_module.py
from my_first_module import foo
def bar():
print('CrazyLogger is not active in this module - only in my_first_module')
foo()
# CrazyLogger only has an effect when `foo` is called.
```
# Feedback and contributing
This library is very focused on being easy and fun to use, so if you find something that you think can be improved
please open an issue or even better, a PR, thank you!
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl crazylog-0.1.1:
pip install crazylog-0.1.1.whl
نصب پکیج tar.gz crazylog-0.1.1:
pip install crazylog-0.1.1.tar.gz