Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Benoit Rousselle
bliss
Commits
22f85992
Commit
22f85992
authored
May 21, 2019
by
Matias Guijarro
Browse files
logtools: 'debugon' also activates underlying loggers in the map
parent
7d446df9
Changes
1
Hide whitespace changes
Inline
Side-by-side
bliss/common/logtools.py
View file @
22f85992
...
...
@@ -12,7 +12,7 @@ import functools
import
networkx
as
nx
from
bliss.common.utils
import
autocomplete_property
from
bliss.common.mapping
import
format_node
from
bliss.common.mapping
import
format_node
,
map_id
from
bliss.common
import
session
__all__
=
[
"lslog"
,
"lsdebug"
]
...
...
@@ -46,6 +46,27 @@ def improve_logger(logger_instance):
def
debugon
(
self
):
"""Activates debug on the device"""
# get the map
session_map
=
session
.
get_current
().
map
# find the node that has this logger
for
node_name
in
session_map
:
node
=
session_map
[
node_name
]
if
node
.
get
(
"_logger"
)
is
self
:
break
else
:
raise
RuntimeError
(
"Could not find node!"
)
# find successor nodes
instance
=
node
[
"instance"
]()
if
instance
is
None
:
raise
RuntimeError
(
"Underlying object has been destroyed"
)
for
n
in
session_map
.
G
.
successors
(
map_id
(
instance
)):
node
=
session_map
[
n
]
try
:
node
[
"_logger"
].
setLevel
(
logging
.
DEBUG
)
except
KeyError
:
continue
self
.
setLevel
(
logging
.
DEBUG
)
def
debugoff
(
self
):
...
...
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