인프런 파일명 변경 테스트
This commit is contained in:
34
debugger.py
Normal file
34
debugger.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Time : 2022/05/14 2:20 PM
|
||||
# @Author : yommi
|
||||
# @Site :
|
||||
# @File : debugger.py
|
||||
# @Software: PyCharm
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
format="[%(asctime)s] [%(levelname)s] %(name)s: %(message)s",
|
||||
datefmt="%Y-%m-%d %H:%M:%S %z",
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Debugger:
|
||||
"""Debug a method and return it back"""
|
||||
|
||||
def __init__(self, func):
|
||||
self.func = func
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
logger.debug(f"Entering : {self.func.__name__}")
|
||||
logger.debug(f"args, kwargs : {args, kwargs}")
|
||||
|
||||
result = self.func(*args, **kwargs)
|
||||
|
||||
logger.debug(f"{self.func.__name__} returned : {result}")
|
||||
|
||||
return result
|
||||
Reference in New Issue
Block a user