https://github.com/meanstrong/log-handler-daily-path
一个每日切换日志路径模块
https://github.com/meanstrong/log-handler-daily-path
logging python3
Last synced: about 1 year ago
JSON representation
一个每日切换日志路径模块
- Host: GitHub
- URL: https://github.com/meanstrong/log-handler-daily-path
- Owner: meanstrong
- License: gpl-3.0
- Created: 2021-01-26T15:48:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-19T02:48:19.000Z (over 5 years ago)
- Last Synced: 2025-03-17T22:06:48.916Z (over 1 year ago)
- Topics: logging, python3
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# log-handler-daily-path - 一个每日切换日志路径模块
[](https://pypi.org/project/log-handler-daily-path/)
[](https://pypi.org/project/log-handler-daily-path/)
## About
这是一个日志路径每日轮转模块,按照指定方式每日切换日志输出路径。
日志输出的路径为: { base_path }/{ yyyy-MM-dd }/{ filename }
## Requirements
- Python3
## Install
通过pip命令安装:
```shell
pip install log-handler-daily-path
```
## Usage
```python
import logging
from log_handler_daily_path import DailyRotatingPathHander
logging.basicConfig(level=logging.DEBUG)
log_handler = DailyRotatingPathHander(base_path="/var/log", filename="app.log", backup_days=30)
logging.getLogger().addHandler(log_handler)
logger = logging.getLogger("Logger")
logger.info("xxx")
```
## Author
- Rocky Peng