MCPcopy
hub / github.com/cherrypy/cherrypy / emit

Method emit

cherrypy/_cplogging.py:428–449  ·  view source on GitHub ↗

Emit a record.

(self, record)

Source from the content-addressed store, hash-verified

426 stream.flush()
427
428 def emit(self, record):
429 """Emit a record."""
430 try:
431 stream = cherrypy.serving.request.wsgi_environ.get('wsgi.errors')
432 except (AttributeError, KeyError):
433 pass
434 else:
435 try:
436 msg = self.format(record)
437 fs = '%s\n'
438 import types
439 # if no unicode support...
440 if not hasattr(types, 'UnicodeType'):
441 stream.write(fs % msg)
442 else:
443 try:
444 stream.write(fs % msg)
445 except UnicodeError:
446 stream.write(fs % msg.encode('UTF-8'))
447 self.flush()
448 except Exception:
449 self.handleError(record)
450
451
452class LazyRfc3339UtcTime(object):

Callers

nothing calls this directly

Calls 5

flushMethod · 0.95
formatMethod · 0.80
writeMethod · 0.80
encodeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected