forked from zk4/baiduFuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.py
29 lines (20 loc) · 753 Bytes
/
log.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import logging
import sys
def get_my_logger(name):
# formatter = logging.Formatter(fmt='%(asctime)s - %(levelname)s - %(module)s - %(message)s')
formatter = logging.Formatter(fmt='%(module)s:%(lineno)d - %(levelname)s - %(message)s')
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
logger.addHandler(handler)
return logger
logger = get_my_logger(__name__)
logger.setLevel(logging.DEBUG)
def funcLog(func):
def wrapper(*args, **kw):
ret= func(*args, **kw)
# logger.debug(f'{func.__name__},{args[1]} => {ret}')
# logger.debug(f'{func.__name__},{args[1]} => {ret}')
return ret
return wrapper