Skip to main content

A lightweight colorful logger with optional daily rotating file output.

Project description

dlz-logger

dlz-logger 是一个轻量级彩色日志库,支持控制台着色输出,以及按天切分的文件日志。

安装

pip install dlz-logger

推荐调用方式

现在可以直接省略 __name__

from datetime import datetime
from dlz_logger import get_logger

LOG_LEVEL = 10

logger = get_logger(
    log_level=LOG_LEVEL,
    save=True,
    file_name=f"收费单识别-{datetime.now():%Y%m%d_%H%M%S}",
)

logger.info("开始识别")

类式调用

from dlz_logger import LOGGER

logger = LOGGER(
    log_level=10,
    save=True,
    file_name="demo"
).get_logger()

logger.info("hello")

功能特性

  • 控制台彩色输出
  • 按天轮转文件日志
  • 自动推断调用方模块名
  • 同时支持函数式和类式调用

本地构建

python -m build

发布到 PyPI

先配置 PyPI Token:

set TWINE_USERNAME=__token__
set TWINE_PASSWORD=pypi-xxxxxxxxxxxxxxxxxxxx

然后执行:

python -m twine upload dist/*

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

dlz_logger-0.2.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

dlz_logger-0.2.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file dlz_logger-0.2.0.tar.gz.

File metadata

  • Download URL: dlz_logger-0.2.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for dlz_logger-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0b5fcab97423506f401b000635113b1a030a391c1085e032528975b7a83d63e1
MD5 dcd6e2e53fe25613f4897de25921b642
BLAKE2b-256 ef1b816fc0b94432a78ec553ee4b62541ee1937996d2c9e46e5d30948ea02b61

See more details on using hashes here.

File details

Details for the file dlz_logger-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dlz_logger-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for dlz_logger-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 138dce79ecf375370f521d72287a38dd179c813facf72fb1851cba6d7e144ee6
MD5 a08f11be6a7aaaab2f224a01c1890761
BLAKE2b-256 dfcfc7bcf6d9407d3bc4768b8fe7347382fdcaf7f09ddf4d62175bf321e75dcf

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