MCPcopy Index your code
hub / github.com/RustPython/RustPython / prepare

Method prepare

Lib/logging/handlers.py:1469–1500  ·  view source on GitHub ↗

Prepare a record for queuing. The object returned by this method is enqueued. The base implementation formats the record to merge the message and arguments, and removes unpickleable items from the record in-place. Specifically, it overwrites the record's `ms

(self, record)

Source from the content-addressed store, hash-verified

1467 self.queue.put_nowait(record)
1468
1469 def prepare(self, record):
1470 """
1471 Prepare a record for queuing. The object returned by this method is
1472 enqueued.
1473
1474 The base implementation formats the record to merge the message and
1475 arguments, and removes unpickleable items from the record in-place.
1476 Specifically, it overwrites the record's `msg` and
1477 `message` attributes with the merged message (obtained by
1478 calling the handler's `format` method), and sets the `args`,
1479 `exc_info` and `exc_text` attributes to None.
1480
1481 You might want to override this method if you want to convert
1482 the record to a dict or JSON string, or send a modified copy
1483 of the record while leaving the original intact.
1484 """
1485 # The format operation gets traceback text into record.exc_text
1486 # (if there's exception data), and also returns the formatted
1487 # message. We can then use this to replace the original
1488 # msg + args, as these might be unpickleable. We also zap the
1489 # exc_info, exc_text and stack_info attributes, as they are no longer
1490 # needed and, if not None, will typically not be pickleable.
1491 msg = self.format(record)
1492 # bpo-35726: make copy of record to avoid affecting other handlers in the chain.
1493 record = copy.copy(record)
1494 record.message = msg
1495 record.msg = msg
1496 record.args = None
1497 record.exc_info = None
1498 record.exc_text = None
1499 record.stack_info = None
1500 return record
1501
1502 def emit(self, record):
1503 """

Callers 1

emitMethod · 0.95

Calls 2

formatMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected