@@ -111,6 +111,7 @@ def _wrap_all_logging(self, preserve_log_handlers: bool):
111
111
HandlerWrapper ,
112
112
log_stream = self .log_stream ,
113
113
log_to_wrapped = preserve_log_handlers ,
114
+ callback = self .refresh ,
114
115
)
115
116
116
117
# Update all existing handlers
@@ -151,13 +152,6 @@ def _refresh(self, force, use_previous):
151
152
max_log_lines = log_height - 2 # top/bottom frame
152
153
content_height = height - log_height
153
154
154
- self ._log .debug (
155
- "height: %d, log_height: %d, content_height: %d" ,
156
- height ,
157
- log_height ,
158
- content_height ,
159
- )
160
-
161
155
# Add the log console
162
156
heading = "== CONSOLE "
163
157
raw_log_lines = filter (
@@ -226,6 +220,7 @@ def __init__(
226
220
wrapped_handler : logging .Handler ,
227
221
log_stream : TextIO ,
228
222
log_to_wrapped : bool = False ,
223
+ callback : Optional [Callable [[], None ]] = None ,
229
224
):
230
225
"""Set up with the handler to wrap
231
226
@@ -238,6 +233,7 @@ def __init__(
238
233
self .wrapped_handler = wrapped_handler
239
234
self .log_stream = log_stream
240
235
self .log_to_wrapped = log_to_wrapped
236
+ self .callback = callback
241
237
super ().__init__ ()
242
238
243
239
# Forward all handler methods to the wrapped handler except those
@@ -265,3 +261,5 @@ def emit(self, record: logging.LogRecord):
265
261
self .log_stream .flush ()
266
262
if self .log_to_wrapped :
267
263
self .wrapped_handler .emit (record )
264
+ if self .callback :
265
+ self .callback ()
0 commit comments