Skip to main content

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

修复自动init报错的问题(StarWorld汇报)

Metadata

Release files for XPyLogger 1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for XPyLogger 1.5
File Size Uploaded
XPyLogger-1.5.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for XPyLogger 1.5
File Interpreter ABI Platform
XPyLogger-1.5-py3-none-any.whl Python 3 none any Details

Total release size: 5.7 kB

Release files / XPyLogger-1.5.tar.gz

Download URL XPyLogger-1.5.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f6aa6ef2953db7088a58136d3f6687b35a657747c13fe78a3191b813dde642d9
BLAKE2b-256 checksum
How to use checksums
97e79a109a00953a826f75228a6072e162979561ec921f36312ef8561aca0225
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / XPyLogger-1.5-py3-none-any.whl

Download URL XPyLogger-1.5-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e41d70ec2c7962bc81ec56ad1045559c2e93cfe1e16f3f9aa949ee9b0e741153
BLAKE2b-256 checksum
How to use checksums
78d998ab7a3d3248176c1f2d2f95288a2ca28267cd2a8f7244d4de70dcdc11cf
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.5 This release

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page