Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
rqt_dynamic_graph
Commits
7898d531
Commit
7898d531
authored
Oct 05, 2017
by
Andrea Del Prete
Browse files
Add logging to text files in dyrectory ~/.rqt_dynamic_graph
parent
b621d765
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/rqt_dynamic_graph/spyder_console_widget.py
View file @
7898d531
...
...
@@ -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
"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment