suny-downstate-medical-center / netpyne

A Python package to facilitate the development, parallel simulation, optimization and analysis of multiscale biological neuronal networks in NEURON.
http://www.netpyne.org
MIT License
144 stars 135 forks source link

Make netpyne less verbose #619

Open lakesare opened 3 years ago

lakesare commented 3 years ago

Please describe the new feature you'd like to see.

Hi! I'd like disable all informational netpyne print() statements. Right now I resort to suppressing standard output (e.g. when I use netpyne with sciunit):

image

Describe the solution you'd like

I'd like netpyne to use the logging package instead of prints, as in:

import logging
logger = logging.getLogger('netpyne')
logger.info("Something happened")

So that a user can disable it with:

import logging
logging.getLogger('netpyne').setLevel(logging.WARNING)

Describe alternatives you've considered

Another good option is to make wider use of sim.cfg.verbose, though it may be hard to track whether all print statements are preceeded with if sim.cfg.verbose:, and users will have to use netpyne's verbose option instead of the standard getLogger().setLevel().