1. Do you know about dagster's Compute Logs, which already captures stdout+stderr for each op? If not, check them out.
2. If compute logs aren't suitable and you really do want to redirect stdout to dagster event logs, you can use
contextlib.redirect_stdout to redirect output to a file-like object. You could design such an object that calls
<http://context.log.info|context.log.info>
in its
write
method.