Skip to main content

自定义日志模式

Project description

-- coding: UTF-8 --

Version: 0.0.1 日志模板 目前仅支持自定义消息处理 使用log请直接再文件中导入 from luckylog import Logger 如需要保存为文件,则需要导入整个文件获取全局变量 import logger 执行:Logger.sccess(xxx) 文件中有两个全局变量,当设置 path 为保存的文件位置和格式,module为选择保存的类型 module = 'success,erro,worning,tip' 目前有四种类型的日志消息 目前展示类型:运行时间、函数名称、文件路径、状态、行数,格式固定,固定调用即显示 success:成功; erro:错误; worning:警告; tip:提示;

添加装饰器功能: 装饰器使用: from luckylog import logger (注意是小写的l) 装饰器自带两个参数,success和erro,代表自定义的成功和失败自定义消息 使用:在需要使用的def放上 @logger(success=xxx,erro=xxx) 如果不定义消息,则默认成功为--Success,失败为--Erro 使用装饰器后可不用带异常错误处理 装饰器不能用在类class上,可能出现报错而日志显示成功的情况

增设全局变量debug_file,当debug_file传入文件路径时(包含文件本身及格式),系统将判断函数执行正确性,失败则将报错写入路径中的文件 函数运行成功将不会保存并写入文件 debug_file保存内容:运行事件,函数名称,文件路径,报错信息 !!!!!debug_file的保存文件方式,目前仅支持 @logger() 装饰器形式的启用!!!!!

v1.0.0 Logger改为元组形式,可输入不限定参数 装饰器增加Debug模式,from luckylog import luckylog luckylog.Debug = True 可开启debug模式,默认关闭状态 Debug模式开启,使用装饰器,成功增加返回输入参数,失败增加返回参数和异常报错信息 Arguments/Exception 错误日志增加输入参数

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

luckylog-1.0.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

luckylog-1.0.1-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file luckylog-1.0.1.tar.gz.

File metadata

  • Download URL: luckylog-1.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/3.7.3 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

File hashes

Hashes for luckylog-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a362e26a740677dbf43b33f4a41f978f2810132d962a9ba502c3896e7af4c193
MD5 9cdd4af50d7a3e0941af5ed4cbb25305
BLAKE2b-256 99d9d2c9f698196bc10489a856955ba9b1e96d1baabde8dc00ddbc36eba586ad

See more details on using hashes here.

File details

Details for the file luckylog-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: luckylog-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/3.7.3 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

File hashes

Hashes for luckylog-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f83b27febca13d87da6d00a9817edecfbf7196b4611e083bd83f70c0753179c1
MD5 526048d461652d881bcc3fef6f31dae4
BLAKE2b-256 ba1fce93f52f22e1e7ae9ca92b89827ce74459bea071eb907a7a3ff42c285301

See more details on using hashes here.

Supported by

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