summaryrefslogtreecommitdiffstats
path: root/repo_trace.py
diff options
context:
space:
mode:
Diffstat (limited to 'repo_trace.py')
-rw-r--r--repo_trace.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/repo_trace.py b/repo_trace.py
index 86cbfc62..9016cb0c 100644
--- a/repo_trace.py
+++ b/repo_trace.py
@@ -32,19 +32,14 @@ REPO_TRACE = 'REPO_TRACE'
32 32
33# Temporarily set tracing to always on unless user expicitly sets to 0. 33# Temporarily set tracing to always on unless user expicitly sets to 0.
34_TRACE = os.environ.get(REPO_TRACE) != '0' 34_TRACE = os.environ.get(REPO_TRACE) != '0'
35
36_TRACE_TO_STDERR = False 35_TRACE_TO_STDERR = False
37
38_TRACE_FILE = None 36_TRACE_FILE = None
39
40_TRACE_FILE_NAME = 'TRACE_FILE' 37_TRACE_FILE_NAME = 'TRACE_FILE'
41
42_MAX_SIZE = 70 # in mb 38_MAX_SIZE = 70 # in mb
43
44_NEW_COMMAND_SEP = '+++++++++++++++NEW COMMAND+++++++++++++++++++' 39_NEW_COMMAND_SEP = '+++++++++++++++NEW COMMAND+++++++++++++++++++'
45 40
46 41
47def IsStraceToStderr(): 42def IsTraceToStderr():
48 return _TRACE_TO_STDERR 43 return _TRACE_TO_STDERR
49 44
50 45
@@ -90,7 +85,7 @@ class Trace(ContextDecorator):
90 if not IsTrace(): 85 if not IsTrace():
91 return self 86 return self
92 87
93 print_msg = f"PID: {os.getpid()} START: {self._time()} :" + self._trace_msg + '\n' 88 print_msg = f'PID: {os.getpid()} START: {self._time()} :' + self._trace_msg + '\n'
94 89
95 with open(_TRACE_FILE, 'a') as f: 90 with open(_TRACE_FILE, 'a') as f:
96 print(print_msg, file=f) 91 print(print_msg, file=f)
@@ -104,7 +99,7 @@ class Trace(ContextDecorator):
104 if not IsTrace(): 99 if not IsTrace():
105 return False 100 return False
106 101
107 print_msg = f"PID: {os.getpid()} END: {self._time()} :" + self._trace_msg + '\n' 102 print_msg = f'PID: {os.getpid()} END: {self._time()} :' + self._trace_msg + '\n'
108 103
109 with open(_TRACE_FILE, 'a') as f: 104 with open(_TRACE_FILE, 'a') as f:
110 print(print_msg, file=f) 105 print(print_msg, file=f)