私有的log以及log的oss上传包
Project description
dilog
dilog 是一个用于日志记录和上传到阿里云OSS的私有Python包。它提供了日志记录功能,以及将日志文件压缩并上传到阿里云OSS的功能,非常适合在私有项目中使用。
功能特点
- 日志记录: 支持将日志记录到本地文件,支持多级别日志(DEBUG、INFO、ERROR、SYSTEM)。
- 日志上传: 自动将日志文件压缩为zip格式,并上传到阿里云OSS。
- 单例模式: 采用单例模式确保日志处理类只会被实例化一次。
安装
确保安装最新版本
pip install dilog
pip install dilog --upgrade
使用说明
记录日志
from dilog.log_handler import LogHandler
# 获取日志处理器实例
log_handler = LogHandler.get_instance()
# 记录日志
log_handler.report(tag="Initialization", content="LogHandler initialized successfully", level="INFO")
上传日志文件
import os
# 确保环境变量已设置
os.environ['ALI_ACCESS_KEY_ID'] = 'your_access_key_id'
os.environ['ALI_ACCESS_KEY_SECRET'] = 'your_access_key_secret'
os.environ['ALI_OSS_ENDPOINT'] = 'ALI_OSS_ENDPOINT'
os.environ['ALI_BUCKET_NAME'] = 'ALI_BUCKET_NAME'
from dilog.log_handler import handle_error_feedback
# 调用日志处理功能
handle_error_feedback(str)
联系我们:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dilog-0.1.6.tar.gz
(4.8 kB
view details)
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
dilog-0.1.6-py3-none-any.whl
(7.4 kB
view details)
File details
Details for the file dilog-0.1.6.tar.gz.
File metadata
- Download URL: dilog-0.1.6.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
448f471b128031b8775e66420f522ddd63c668e62e73961638008bbf10f3a58b
|
|
| MD5 |
5915e7f9210a79813a913ccf7187c384
|
|
| BLAKE2b-256 |
f65b7493ed3081e5cbca6843c194e0904f04ec439452de536629f1507aff4f41
|
File details
Details for the file dilog-0.1.6-py3-none-any.whl.
File metadata
- Download URL: dilog-0.1.6-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9568d1d59e9874baff12e8ecdc382a02ab4e672e5be80dfb87f0daa69a911a7a
|
|
| MD5 |
f757dceac82af80d53694adc6851e58e
|
|
| BLAKE2b-256 |
4e77d808f2c7f22f0926a9ea6f6a2d5dd028e02dff68db6053496d68a18a762d
|