bernardopaulsen / log_decor

Logging decorators for classes and methods.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

log-decor

Introduction

This package contains decorators that provide logging functionality for functions and methods.

Example

import logging

from log_decor import add_logger, log_msg


@add_logger()
class Example:

    @log_msg('message', level=logging.DEBUG)
    def f1(self):
        pass

    @log_msg(level=logging.INFO)
    def f2(self):
        pass
>>> logging.basicConfig(level=logging.DEBUG)
>>> example = Example()
>>> example.f1()
DEBUG:Example:message
>>> example.f2()
INFO:Example:f2()

About

Logging decorators for classes and methods.

License:MIT License


Languages

Language:Python 100.0%