Package com.illumon.ipykernel
Class PythonLogEchoRedirecter
java.lang.Object
com.illumon.ipykernel.PythonLogEchoRedirecter
public class PythonLogEchoRedirecter extends Object
This echos the python system out and system err to the DH logging, while still printing to the
console
Note: not currently in use, but might be useful to revive in the future.
-
Method Summary
Modifier and Type Method Description void
flush()
https://docs.python.org/2/library/io.html#io.IOBase.flush https://github.com/python/cpython/blob/2.7/Modules/_io/iobase.cstatic void
redirect(org.jpy.PyObject sysModule, com.fishlib.io.logger.Logger log)
int
write(String s)
This method is used from Python so that we appear as a stream.
-
Method Details
-
redirect
public static void redirect(org.jpy.PyObject sysModule, com.fishlib.io.logger.Logger log) -
write
This method is used from Python so that we appear as a stream. We don't want to write the trailing newline, as the Logger implementation will do that for us. If there is no newline; we need to remember that we added one, so that we can suppress the next empty newline. If there was a newline, we shouldn't suppress it (e.g., when printing just a blank line to the output we need to preserve it).- Parameters:
s
- the string to write- Returns:
- the number of characters written
-
flush
public void flush()https://docs.python.org/2/library/io.html#io.IOBase.flush https://github.com/python/cpython/blob/2.7/Modules/_io/iobase.c
-