Skip to main content

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()

终端输出效果:


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

funnylog-2024.5.24.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

funnylog-2024.5.24-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file funnylog-2024.5.24.tar.gz.

File metadata

  • Download URL: funnylog-2024.5.24.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.3

File hashes

Hashes for funnylog-2024.5.24.tar.gz
Algorithm Hash digest
SHA256 b460e609f3698ff451e550bef13a5fb74e010b3127ab55ac700f98f4a7f6cb4d
MD5 39bc4ac716e5032487b47ebb14620ce7
BLAKE2b-256 5b13e74cdbf11dc0151370424899a3581554a678a064569964ee98a4cde027c3

See more details on using hashes here.

File details

Details for the file funnylog-2024.5.24-py3-none-any.whl.

File metadata

  • Download URL: funnylog-2024.5.24-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.3

File hashes

Hashes for funnylog-2024.5.24-py3-none-any.whl
Algorithm Hash digest
SHA256 23573d9b849b158624a1d7d0a08cebdf54c673442e8414502707cfe38140a9db
MD5 80527704ebdeb46bfc8c4dcf4a52d64e
BLAKE2b-256 c2a2bf249d03ec91621816e032a993abcb55155fafc269d17d2d1544ed0f01f3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2024.5.24 This release

2 files

2023.8.23

2 files

2023.6.14

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page