Closed JR-1991 closed 2 years ago
I think this might have to be handled differently. currently, whenever the log attribute is modified there will be new StreamHandlers added to the pyenzyme logger. Especially already during initialization, the 2 handlers will be added already :
enzmldoc = EnzymeMLDocument( ## <-- here the log will be initialized with '' (calling start_logger)
name=model.getName(), level=model.getLevel(), version=model.getVersion()
)
# Add logs to the document
enzmldoc.log = log ## <--- here another set of handlers is added
so at the very least we need to start, by setting the log already in the construction of the document.
However, with this setup, since the pyenzyme
logger class is being used. if we have two documents instantiated side by side, log changes on one document would also materialize in the other one.
to prevent the changes to be written out, you might want to set the pyenzyme logger, to set the propagate
attribute to False
. What is happening, is that after logging on pyenzyme, the record is passed to the root logger, where it is written out, thats why we see it in the notebook.
So maybe add this to your setup_custom_logger
function.
According to the
EnzymeMLBase
class every change should be logged to the objectslog
-attribute, but in the case of Thin Layers, when writing out, these are written tostdout
. In addition, the resulting document lacks these logs, although changes have been applied.Out: