Changeset 4320
- Timestamp:
- Apr 19, 2017, 2:14:09 PM (4 years ago)
- Location:
- syncer-plank/trunk/fuentes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
syncer-plank/trunk/fuentes/debian/changelog
r4303 r4320 1 syncer-plank (0.3-1) xenial; urgency=medium 2 3 * Disable debug code 4 5 -- M.Angel Juan <m.angel.juan@gmail.com> Wed, 19 Apr 2017 14:13:38 +0200 6 1 7 syncer-plank (0.3) xenial; urgency=medium 2 8 -
syncer-plank/trunk/fuentes/syncer-plank.install/usr/bin/syncer-plank-gui
r4307 r4320 13 13 # 14 14 ############################## 15 import logging16 from colorlog import ColoredFormatter17 from functools import wraps15 #import logging 16 #from colorlog import ColoredFormatter 17 #from functools import wraps 18 18 import time 19 20 def setup_logger():21 """Return a logger with a default ColoredFormatter."""22 formatter = ColoredFormatter(23 "(%(threadName)-9s) %(log_color)s%(levelname)-8s%(reset)s %(message_log_color)s%(message)s",24 datefmt=None,25 reset=True,26 log_colors={27 'DEBUG': 'cyan',28 'INFO': 'green',29 'WARNING': 'yellow',30 'ERROR': 'red',31 'CRITICAL': 'red',32 },33 secondary_log_colors={34 'message': {35 'ERROR': 'red',36 'CRITICAL': 'red',37 'DEBUG': 'yellow'38 }39 },40 style='%'41 )42 43 logger = logging.getLogger(__name__)44 handler = logging.StreamHandler()45 handler.setFormatter(formatter)46 logger.addHandler(handler)47 logger.setLevel(logging.DEBUG)48 49 return logger50 51 def trace(func):52 """Tracing wrapper to log when function enter/exit happens.53 :param func: Function to wrap54 :type func: callable55 """56 @wraps(func)57 def wrapper(*args, **kwargs):58 t=time.time()59 strdebug='{0:0.3f} Start {1!r} '. format(t-start_time,func.__name__)60 #strdebug+='KWARGS={} ARGS={}'.format(kwargs,args)61 #62 # Filter parameters63 #64 out={}65 for x in kwargs:66 text=str(kwargs[x])67 if len(text) < 30 and 'object at' not in text:68 out[x]=str(kwargs[x])69 else:70 out[x]='Skipped'71 i=072 for x in args:73 text=str(x)74 if len(text) < 30 and 'object at' not in text:75 out['arg' + str(i)] = x76 else:77 out['arg' + str(i)] = 'Skipped'78 i += 179 strdebug += 'Parameters: {}'.format(out)80 logger.debug(strdebug)81 result = func(*args, **kwargs)82 logger.debug('+{0:0.3f} End {1!r}'. format(time.time()-t,func.__name__))83 return result84 return wrapper85 86 start_time=time.time()87 logger = setup_logger()88 19 # 20 #def setup_logger(): 21 # """Return a logger with a default ColoredFormatter.""" 22 # formatter = ColoredFormatter( 23 # "(%(threadName)-9s) %(log_color)s%(levelname)-8s%(reset)s %(message_log_color)s%(message)s", 24 # datefmt=None, 25 # reset=True, 26 # log_colors={ 27 # 'DEBUG': 'cyan', 28 # 'INFO': 'green', 29 # 'WARNING': 'yellow', 30 # 'ERROR': 'red', 31 # 'CRITICAL': 'red', 32 # }, 33 # secondary_log_colors={ 34 # 'message': { 35 # 'ERROR': 'red', 36 # 'CRITICAL': 'red', 37 # 'DEBUG': 'yellow' 38 # } 39 # }, 40 # style='%' 41 # ) 42 # 43 # logger = logging.getLogger(__name__) 44 # handler = logging.StreamHandler() 45 # handler.setFormatter(formatter) 46 # logger.addHandler(handler) 47 # logger.setLevel(logging.DEBUG) 48 # 49 # return logger 50 # 51 #def trace(func): 52 # """Tracing wrapper to log when function enter/exit happens. 53 # :param func: Function to wrap 54 # :type func: callable 55 # """ 56 # @wraps(func) 57 # def wrapper(*args, **kwargs): 58 # t=time.time() 59 # strdebug='{0:0.3f} Start {1!r} '. format(t-start_time,func.__name__) 60 # #strdebug+='KWARGS={} ARGS={}'.format(kwargs,args) 61 # # 62 # # Filter parameters 63 # # 64 # out={} 65 # for x in kwargs: 66 # text=str(kwargs[x]) 67 # if len(text) < 30 and 'object at' not in text: 68 # out[x]=str(kwargs[x]) 69 # else: 70 # out[x]='Skipped' 71 # i=0 72 # for x in args: 73 # text=str(x) 74 # if len(text) < 30 and 'object at' not in text: 75 # out['arg' + str(i)] = x 76 # else: 77 # out['arg' + str(i)] = 'Skipped' 78 # i += 1 79 # strdebug += 'Parameters: {}'.format(out) 80 # logger.debug(strdebug) 81 # result = func(*args, **kwargs) 82 # logger.debug('+{0:0.3f} End {1!r}'. format(time.time()-t,func.__name__)) 83 # return result 84 # return wrapper 85 # 86 #start_time=time.time() 87 #logger = setup_logger() 88 # 89 89 def dbg(*args,**kwargs): 90 90 enable=False
Note: See TracChangeset
for help on using the changeset viewer.