File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -61,8 +61,18 @@ class PEMicroProbe(DebugProbe):
61
61
# matching the system's architecture, or other similar reasons.
62
62
NO_LIBRARY_ERR = "Unable to find any usable library"
63
63
64
+ _set_pypemicro_log_level = False
65
+ _saved_pypemicro_logger_level = 0
66
+
64
67
@classmethod
65
68
def _get_pemicro (cls ):
69
+ # Work around voluminous logging from pypemicro.
70
+ if not cls ._set_pypemicro_log_level :
71
+ cls ._set_pypemicro_log_level = True
72
+ pelogger = logging .getLogger ('pypemicro' )
73
+ cls ._saved_pypemicro_logger_level = pelogger .getEffectiveLevel ()
74
+ pelogger .setLevel (logging .WARNING )
75
+
66
76
# PEMicroException is raised by PyPemicro if the PEMicro DLL cannot be found.
67
77
try :
68
78
return PyPemicro (log_debug = TRACE .debug ,
@@ -113,6 +123,10 @@ def __init__(self, serial_number):
113
123
if self ._pemicro is None :
114
124
raise exceptions .ProbeError ("unable to get PEMicro DLL" )
115
125
126
+ # Set log level back to what it was originally. Note that this trick has race issues if multiple probes
127
+ # are accessed simultaneously within one process.
128
+ logging .getLogger ('pypemicro' ).setLevel (self ._saved_pypemicro_logger_level )
129
+
116
130
self ._serial_number = serial_number
117
131
self ._supported_protocols = []
118
132
self ._protocol = None
You can’t perform that action at this time.
0 commit comments