From babfe17afb467042070ddca721cdd53ff4e50d2a Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Wed, 6 Jul 2016 16:37:52 +0200 Subject: [PATCH] prevent captured exception from showing when logging other tracebacks --- wakatime/logger.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wakatime/logger.py b/wakatime/logger.py index c3d7635..525945c 100644 --- a/wakatime/logger.py +++ b/wakatime/logger.py @@ -73,10 +73,9 @@ class JsonFormatter(logging.Formatter): def traceback_formatter(*args, **kwargs): - try: - level = kwargs.get('level', args[0]).lower() - except: - level = None + level = kwargs.get('level', args[0] if len(args) else None) + if level: + level = level.lower() if level == 'warn' or level == 'warning': logging.getLogger('WakaTime').warning(traceback.format_exc()) elif level == 'info':