mne-tools / mne-bids-pipeline

Automatically process entire electrophysiological datasets using MNE-Python.
https://mne.tools/mne-bids-pipeline/
BSD 3-Clause "New" or "Revised" License
138 stars 66 forks source link

implement expandable logging system #921

Open SophieHerbst opened 6 months ago

SophieHerbst commented 6 months ago

Follow-up from #914 Aim: Provide more information from MNE's logging (currently set to 'error' by default) in the pipeline's log: implement a logging system via rich where the user can expand and collapse entire log sections -- in a separate file?

larsoner commented 6 months ago

In principle Python's logging system, which is used by mne, can have arbitrary handlers attached. So one way to do this would be to

  1. Set the logging level to info or whatever
  2. Remove all existing handlers
  3. Add a custom message handler that took whatever message was logged and hook it into our rich logging system

I think in principle this shouldn't be too bad to do. Could be fun for someone interested in experimenting with rich.

Maybe we could start with trying the rich-collapsible support first, and see if that's enough. Then maybe we don't need a file at all (or | tee <whatever> in the terminal could be good enough for logging mne_bids_pipeline calls).