MDU-PHL / bohra

A pipeline for bioinformatics analysis of bacterial genomes
GNU General Public License v3.0
19 stars 4 forks source link

Best practice for `logging` #8

Closed andersgs closed 5 years ago

andersgs commented 5 years ago

A good convention is to put at the top of each *.py file or module:

import logging

logging.basicConfig(format='[%(asctime)s] %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.INFO)
logger = logging.getLogger(__name__)

Then call logger wherever needed (e.g., logger.info("Starting up"))

kristyhoran commented 5 years ago

Done