##// END OF EJS Templates
lazy-formatting logs in ipkernel...
MinRK -
Show More
@@ -170,13 +170,13 class Kernel(Configurable):
170 170 # Print some info about this message and leave a '--->' marker, so it's
171 171 # easier to trace visually the message chain when debugging. Each
172 172 # handler prints its message at the end.
173 self.log.debug('\n*** MESSAGE TYPE:'+str(msg_type)+'***')
174 self.log.debug(' Content: '+str(msg['content'])+'\n --->\n ')
173 self.log.debug('\n*** MESSAGE TYPE:%s***', msg_type)
174 self.log.debug(' Content: %s\n --->\n ', msg['content'])
175 175
176 176 # Find and call actual handler for message
177 177 handler = self.handlers.get(msg_type, None)
178 178 if handler is None:
179 self.log.error("UNKNOWN MESSAGE TYPE:" +str(msg))
179 self.log.error("UNKNOWN MESSAGE TYPE: %s", msg)
180 180 else:
181 181 handler(ident, msg)
182 182
@@ -267,7 +267,7 class Kernel(Configurable):
267 267 silent = content[u'silent']
268 268 except:
269 269 self.log.error("Got bad msg: ")
270 self.log.error(str(Message(parent)))
270 self.log.error("%s", parent)
271 271 return
272 272
273 273 shell = self.shell # we'll need this a lot here
@@ -365,7 +365,7 class Kernel(Configurable):
365 365 reply_content = json_clean(reply_content)
366 366 reply_msg = self.session.send(self.shell_socket, u'execute_reply',
367 367 reply_content, parent, ident=ident)
368 self.log.debug(str(reply_msg))
368 self.log.debug("%s", reply_msg)
369 369
370 370 if reply_msg['content']['status'] == u'error':
371 371 self._abort_queue()
@@ -383,7 +383,7 class Kernel(Configurable):
383 383 matches = json_clean(matches)
384 384 completion_msg = self.session.send(self.shell_socket, 'complete_reply',
385 385 matches, parent, ident)
386 self.log.debug(str(completion_msg))
386 self.log.debug("%s", completion_msg)
387 387
388 388 def object_info_request(self, ident, parent):
389 389 content = parent['content']
@@ -394,7 +394,7 class Kernel(Configurable):
394 394 oinfo = json_clean(object_info)
395 395 msg = self.session.send(self.shell_socket, 'object_info_reply',
396 396 oinfo, parent, ident)
397 self.log.debug(msg)
397 self.log.debug("%s", msg)
398 398
399 399 def history_request(self, ident, parent):
400 400 # We need to pull these out, as passing **kwargs doesn't work with
@@ -435,7 +435,7 class Kernel(Configurable):
435 435 content = {}
436 436 msg = self.session.send(self.shell_socket, 'connect_reply',
437 437 content, parent, ident)
438 self.log.debug(msg)
438 self.log.debug("%s", msg)
439 439
440 440 def shutdown_request(self, ident, parent):
441 441 self.shell.exit_now = True
@@ -456,7 +456,7 class Kernel(Configurable):
456 456 msg_id = parent['header']['msg_id']
457 457 # bound = parent['header'].get('bound', False)
458 458 except:
459 self.log.error("Got bad msg: %s"%parent, exc_info=True)
459 self.log.error("Got bad msg: %s", parent, exc_info=True)
460 460 return
461 461 # pyin_msg = self.session.msg(u'pyin',{u'code':code}, parent=parent)
462 462 # self.iopub_stream.send(pyin_msg)
@@ -540,7 +540,7 class Kernel(Configurable):
540 540 return
541 541
542 542 self.log.info("Aborting:")
543 self.log.info(str(msg))
543 self.log.info("%s", msg)
544 544 msg_type = msg['header']['msg_type']
545 545 reply_type = msg_type.split('_')[0] + '_reply'
546 546 # reply_msg = self.session.msg(reply_type, {'status' : 'aborted'}, msg)
@@ -548,7 +548,7 class Kernel(Configurable):
548 548 # self.reply_socket.send_json(reply_msg)
549 549 reply_msg = self.session.send(stream, reply_type,
550 550 content={'status' : 'aborted'}, parent=msg, ident=idents)
551 self.log.debug(str(reply_msg))
551 self.log.debug("%s", reply_msg)
552 552 # We need to wait a bit for requests to come in. This can probably
553 553 # be set shorter for true asynchronous clients.
554 554 time.sleep(0.05)
@@ -566,7 +566,7 class Kernel(Configurable):
566 566 content = dict(status='ok')
567 567 reply_msg = self.session.send(stream, 'abort_reply', content=content,
568 568 parent=parent, ident=ident)
569 self.log.debug(str(reply_msg))
569 self.log.debug("%s", reply_msg)
570 570
571 571 def clear_request(self, stream, idents, parent):
572 572 """Clear our namespace."""
@@ -593,12 +593,12 class Kernel(Configurable):
593 593 assert ident is not None, \
594 594 "Unexpected missing message part."
595 595
596 self.log.debug("Aborting:\n"+str(Message(msg)))
596 self.log.debug("Aborting:\n%s", msg)
597 597 msg_type = msg['header']['msg_type']
598 598 reply_type = msg_type.split('_')[0] + '_reply'
599 599 reply_msg = self.session.send(self.shell_socket, reply_type,
600 600 {'status' : 'aborted'}, msg, ident=ident)
601 self.log.debug(reply_msg)
601 self.log.debug("%s", reply_msg)
602 602 # We need to wait a bit for requests to come in. This can probably
603 603 # be set shorter for true asynchronous clients.
604 604 time.sleep(0.1)
@@ -631,7 +631,7 class Kernel(Configurable):
631 631 value = reply['content']['value']
632 632 except:
633 633 self.log.error("Got bad raw_input reply: ")
634 self.log.error(str(Message(parent)))
634 self.log.error("%s", parent)
635 635 value = ''
636 636 if value == '\x04':
637 637 # EOF
@@ -688,7 +688,7 class Kernel(Configurable):
688 688 if self._shutdown_message is not None:
689 689 self.session.send(self.shell_socket, self._shutdown_message)
690 690 self.session.send(self.iopub_socket, self._shutdown_message)
691 self.log.debug(str(self._shutdown_message))
691 self.log.debug("%s", self._shutdown_message)
692 692 # A very short sleep to give zmq time to flush its message buffers
693 693 # before Python truly shuts down.
694 694 time.sleep(0.01)
General Comments 0
You need to be logged in to leave comments. Login now