Commit 7898d531 authored by Andrea Del Prete's avatar Andrea Del Prete
Browse files

Add logging to text files in dyrectory ~/.rqt_dynamic_graph

parent b621d765
......@@ -43,6 +43,9 @@ import dynamic_graph_bridge_msgs.srv
from spyderlib.utils.dochelpers import getobjdir
from datetime import datetime
import os
class SpyderConsoleWidget(InternalShell):
_multi_line_char = ':'
_multi_line_indent = ''
......@@ -66,6 +69,18 @@ class SpyderConsoleWidget(InternalShell):
self._multi_line_level = 0
self._command = ''
# open text file for logging
try:
path = os.path.expanduser('~/.rqt_dynamic_graph/');
if(not os.path.exists(path)):
os.mkdir(path)
self.log = open(path+datetime.now().strftime("%y_%m_%d__%H_%M")+'.log', 'a')
#print "Log file successfully open"
except Exception as e:
print "ERROR: Could not open log file!"
print e
self.log = None
def get_module_completion(self, objtxt):
"""Return module completion list associated to object name"""
# FIXME: This executes on the local machine, so it may suggest modules
......@@ -157,6 +172,9 @@ class SpyderConsoleWidget(InternalShell):
print(response.result)
self.flush()
self.interpreter.restore_stds()
if(self.log is not None):
self.log.write(code+'\n')
self.log.flush()
def _runcode(self, code, retry = True):
self.cache += code + "\n"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment