Redirect OTB logger during execution and ensure control over global standard output
It would be nice to have real control over when OTB stdout is printed or not. Especially since, despite of quiet
and other tricks we already use, we still have the ugly progress bar (#33 #53 ).
To make it "pythonic" this can be done using context manager.
Then we'll be able to use tqdm to when processing large number of files.
But we could simply redirect sys.sdout
to a file or buffer during execute()
and flush()
.
This, with quiet=True
and the existing complete log control.
We could automatically redirect stoudout and err to f"/tmp/{pid}.{App.name}.log
or something.
This issue is critical if we want to enable user to run pipelines using multiprocessing.Pool
(I will test this soon, we can probably provide some functions for this in 2.1
).
Edit: In fact quiet removes the progress bar, but I'm pretty sure this wasn't the case before.
Yet we still got messages about RAM etc.
In any case, it would be great to be able to redirect to a file, because we do not always want to ignore the INFO or DEBUG log. But for multiproc, we need to remove any print from stdout.