MCPcopy Create free account
hub / github.com/ipython/ipython / log_write

Method log_write

IPython/core/logger.py:187–201  ·  view source on GitHub ↗

Write data to the log file, if active

(self, data, kind='input')

Source from the content-addressed store, hash-verified

185 self.log_write(line_mod)
186
187 def log_write(self, data, kind='input'):
188 """Write data to the log file, if active"""
189
190 #print 'data: %r' % data # dbg
191 if self.log_active and data:
192 write = self.logfile.write
193 if kind=='input':
194 if self.timestamp:
195 write(time.strftime('# %a, %d %b %Y %H:%M:%S\n', time.localtime()))
196 write(data)
197 elif kind=='output' and self.log_output:
198 odata = u'\n'.join([u'#[Out]# %s' % s
199 for s in data.splitlines()])
200 write(u'%s\n' % odata)
201 self.logfile.flush()
202
203 def logstop(self):
204 """Fully stop logging and close log file.

Callers 3

logMethod · 0.95
log_outputMethod · 0.80
logstartMethod · 0.80

Calls 1

flushMethod · 0.45

Tested by

no test coverage detected