summaryrefslogtreecommitdiffstats
path: root/python.d
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-11-12 14:17:01 +0200
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-11-12 14:17:01 +0200
commita8204a0e864b4e0226ee07243adeb61f007fedf1 (patch)
tree243c3e066bd5b5581a138478ba41bbcbb3d28de2 /python.d
parent56ec680880032bc9e8dcfb32bb163a1e783a6a59 (diff)
enabled option "trace" to get python traces on errors
Diffstat (limited to 'python.d')
-rw-r--r--python.d/python_modules/msg.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/python.d/python_modules/msg.py b/python.d/python_modules/msg.py
index acce1d0f3c..b835c94045 100644
--- a/python.d/python_modules/msg.py
+++ b/python.d/python_modules/msg.py
@@ -1,10 +1,12 @@
# -*- coding: utf-8 -*-
# Description: logging for netdata python.d modules
+import traceback
import sys
from time import time, strftime
DEBUG_FLAG = False
+TRACE_FLAG = False
PROGRAM = ""
LOG_COUNTER = 0
LOG_THROTTLE = 10000 # has to be too big during init
@@ -51,6 +53,9 @@ def log_msg(msg_type, *args):
LOG_NEXT_CHECK = now - (now % LOG_INTERVAL) + LOG_INTERVAL
LOG_COUNTER = 0
+ if TRACE_FLAG:
+ if msg_type == "FATAL" or msg_type == "ERROR" or msg_type == "ALERT":
+ traceback.print_exc()
def debug(*args):