Skip to main content

自定义LOG模块

Project description

logger 模块调用方法

初始化

from twnlog.logger import Logger
logger = Logger().get_logger

调用

logger.debug('调试代码')
logger.info('输出信息')
logger.success('输出成功')
logger.warning('错误警告')
logger.error('代码错误')
logger.critical('崩溃输出')

修改log配置

文件: log.ini 存放位置: python3包安装位置,可以用 pip show logger 查看

# 文件log的配置
[FileLog]
path = /home/szyd/twn-jp  # 文件保存路径
is_open = off  # on打开, off关闭
level = INFO  # 打印什么级别的日志
rotation = 10MB
retention = 7 days

# 控制台log的配置
[StderrLog]
is_open = on
level = INFO  # 打印什么级别的日志

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.

twnlog-0.2.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: twnlog-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for twnlog-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b040d0dd20f01b6c64955d900cd62248da82968e7dedab5d59a3319637e3b2b9
MD5 48dfb68b5905ee01cd39e30f8bc6c904
BLAKE2b-256 ad8a4bcec872aeae8f45f8e1f4ca604480fe8a433074444cd03389243fdf50e6

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