FunnyLog
一个简单易用、功能强大的日志工具。
只需要加一个装饰器,就能自动日志输出类里面所有的方法的功能说明。
Documentation: https://linuxdeepin.github.io/funnylog
Source Code: https://github.com/linuxdeepin/funnylog
安装
pip install funnylog
使用说明
from funnylog import logger
from funnylog import log
from funnylog.conf import setting
setting.CLASS_NAME_ENDSWITH = ("Log",)
logger("DEBUG")
class BaseLog:
def base_self_method(self):
"""我是 基类 里面的实例方法"""
@classmethod
def base_cls_method(self):
"""我是 基类 里面的类方法"""
@staticmethod
def base_static_method():
"""我是 基类 里面的静态方法"""
# 注意这里,只需要在这里挂一个装饰器
@log
class TestLog(BaseLog):
"""继承了基类BaseLog"""
def self_method(self):
"""我是 类 里面的实例方法"""
@classmethod
def cls_method(self):
"""我是 类 里面的类方法"""
@staticmethod
def static_method():
"""我是 类 里面的静态方法"""
if __name__ == '__main__':
# @log装饰器自动打印
TestLog().self_method()
TestLog().cls_method()
TestLog().static_method()
# 直接调用基类里面的方法,也能自动打印
TestLog().base_self_method()
TestLog().base_cls_method()
TestLog().base_static_method()
终端输出效果:
Metadata
Release files for funnylog 2024.5.24
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| funnylog-2024.5.24.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| funnylog-2024.5.24-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.8 kB
Release files / funnylog-2024.5.24.tar.gz
| Download URL | funnylog-2024.5.24.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b460e609f3698ff451e550bef13a5fb74e010b3127ab55ac700f98f4a7f6cb4d
|
|
BLAKE2b-256 checksum How to use checksums |
5b13e74cdbf11dc0151370424899a3581554a678a064569964ee98a4cde027c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.3
|
Release files / funnylog-2024.5.24-py3-none-any.whl
| Download URL | funnylog-2024.5.24-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23573d9b849b158624a1d7d0a08cebdf54c673442e8414502707cfe38140a9db
|
|
BLAKE2b-256 checksum How to use checksums |
c2a2bf249d03ec91621816e032a993abcb55155fafc269d17d2d1544ed0f01f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.7.3
|