cortex-lab / phy

phy: interactive visualization and manual spike sorting of large-scale ephys data
BSD 3-Clause "New" or "Revised" License
311 stars 157 forks source link

Displaying messages from Logger in --debug mode #1114

Closed rhayman closed 2 years ago

rhayman commented 2 years ago

I've written a plugin for phy which works but would like to add some debug information which would display when phy is called in debug mode. I've copied what's been done in other places in the code base and tried:

import logging
logger = logging.getLogger(__name__)

class MyPlugin(ManualClusteringView):
   def __init__(self, features=None):
        # blah
        logger.debug("Debug msg")

But no messages appear when I call phy like so:

phy template-gui params.py --debug

Am I missing something obvious?

rossant commented 2 years ago

I wonder if using:

logger = logging.getLogger("phy")

at line 2 would work?

Another possible solution might be to add a custom logging handler for your plugin.

rhayman commented 2 years ago

Happy to confirm that adding

logger = logging.getLogger("phy")

worked a charm

Thanks for the quick response