Skip to main content

私有的log以及log的oss上传包

Project description

dlog

dlog 是一个用于日志记录和上传到阿里云OSS的私有Python包。它提供了日志记录功能,以及将日志文件压缩并上传到阿里云OSS的功能,非常适合在私有项目中使用。

功能特点

  • 日志记录: 支持将日志记录到本地文件,支持多级别日志(DEBUG、INFO、ERROR、SYSTEM)。
  • 日志上传: 自动将日志文件压缩为zip格式,并上传到阿里云OSS。
  • 单例模式: 采用单例模式确保日志处理类只会被实例化一次。

安装

由于该包是私有的,你需要从 Git 仓库安装:

安装教程

  1. requirements.txt 中添加以下内容:

    git+https://gitee.com/didi_nj/dilog.git@master#egg=dlog
    
  2. 运行以下命令安装依赖:

    pip install -r requirements.txt
    

或者直接使用 pip 从 Git 仓库安装:

pip install git+https://gitee.com/didi_nj/dilog.git@master#egg=dlog

使用说明

记录日志

from dlog.log_handler import LogHandler

# 获取日志处理器实例
log_handler = LogHandler.get_instance()

# 记录日志
log_handler.report(tag="Initialization", content="LogHandler initialized successfully", level="INFO")

上传日志文件

import os
from my_module.log_handler import handle_error_feedback

# 确保环境变量已设置
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'

# 调用日志处理功能
handle_error_feedback()

联系我们:

didiwangluo@outlook.com

Project details


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

If you're not sure about the file name format, learn more about wheel file names.

dilog-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file dilog-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dilog-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for dilog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7c6e211811f91fd66d4af4f27b47926dc1542754bf054b3ab92f206a77f4720
MD5 cfc246007e21317fb7198df44abb3f72
BLAKE2b-256 f7ab3b0110a86c39f1239d28d97e7e6fd15ba811e72e94015d4175a6856d5f95

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page