42 lines
1.0 KiB
Markdown
42 lines
1.0 KiB
Markdown
# Python Reza Logging
|
|
|
|
## Install
|
|
|
|
Use this command:
|
|
|
|
```bash
|
|
pip install git+https://git.d.aiengines.ir/mareza/py_reza_logging.git@{commit_hash}
|
|
```
|
|
|
|
Or when using Python UV:
|
|
|
|
```bash
|
|
uv add git+https://git.d.aiengines.ir/mareza/py_reza_logging.git@{commit_hash}
|
|
```
|
|
|
|
## Usage
|
|
|
|
```python
|
|
from py_reza_logging import setup_logging
|
|
|
|
setup_logging(
|
|
calendar="jalali",
|
|
include_app_name=False,
|
|
include_name=True,
|
|
include_pid=False,
|
|
include_thread=False,
|
|
console_level=logging.INFO,
|
|
use_rich=True,
|
|
time_zone_name="Asia/Tehran",
|
|
)
|
|
logging.getLogger("elasticsearch").setLevel(logging.WARNING)
|
|
logging.getLogger("elastic_transport").setLevel(logging.WARNING)
|
|
logging.getLogger("urllib3").setLevel(logging.WARNING)
|
|
logging.getLogger("tortoise.db_client").setLevel(logging.WARNING)
|
|
logging.getLogger("asyncio").setLevel(logging.WARNING)
|
|
logging.getLogger("tortoise").setLevel(logging.WARNING)
|
|
logging.getLogger("httpx").setLevel(logging.WARNING)
|
|
log = logging.getLogger(__name__)
|
|
log.info("script_started")
|
|
```
|