Skip to main content

一个开箱即用的 log 解决方案

Project description

XLogger

By 这里是小邓

介绍

XPyLogger 是提供了一个开箱即用的日志库,较好的解决了Python 自带 logging 库使用繁琐,函数玄学的问题,支持 rich 库彩色输出。

项目原名 XLogger,后因重名,故改名为 XPyLogger

依赖

  1. Python (3.9+)
  2. Rich

编译步骤

GIT

  1. 克隆 XPyLogger
  2. 放入程序文件夹
  3. 安装rich
pip install rich
  1. from XPyLogger import *

PIP

pip install XPyLogger

函数介绍

XPyLogger.log(msg, level = INFO, sender = SENDER_MAIN)

输出一条日志

  • msg:log信息
  • level:日志等级
  • sender:发送者

XPyLogger.close()

关闭日志本地记录文件

XPyLogger.INFO

日志等级-信息

XPyLogger.WARN

日至等级-警告

XPyLogger.ERR

日志等级-错误

XPyLogger.init(file_enable = True,file_name = int(time.time()),dir_name = "logs")

自定义初始化log对象

  • file_enable:是否启用文件记录
  • file_name:日志文件名(不含.log)
  • dir_name:日志文件夹名

Demo

import XPyLogger as log
log.init(file_enable = False)
log.log("This is a information!",log.INFO)
log.log("This is a warning!",log.WARN)
log.log("This is a error!",log.ERR)
close()

Change Log

更高的自定义性(待测试)

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

XPyLogger-1.4.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

XPyLogger-1.4-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file XPyLogger-1.4.tar.gz.

File metadata

  • Download URL: XPyLogger-1.4.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.1 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for XPyLogger-1.4.tar.gz
Algorithm Hash digest
SHA256 8e06a500752729331e06e222da2ad411cd035c588d9ac29b009c480f586aec48
MD5 ccfbf69bee80bb619a09e605af1c1990
BLAKE2b-256 fe1d650f560b38add9d29a7f31bd20b86d105f787e1388f514c8315169324cad

See more details on using hashes here.

File details

Details for the file XPyLogger-1.4-py3-none-any.whl.

File metadata

  • Download URL: XPyLogger-1.4-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.1 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for XPyLogger-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c3231e0fc102dcec37ea2081383ea467cdd83ce6d198175d577acdb766d5aa84
MD5 5b7e3dd5866f598876ce5a6573734344
BLAKE2b-256 b3ad7e705578be1bdc4ee22b632d12b73bad24e868c54b561778e81086861f99

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