Answers for "python create log"

1

python logging to console exqmple

import sys
# ...
logging.getLogger().addHandler(logging.StreamHandler(sys.stdout))
Posted by: Guest on January-04-2021
7

create log in python

logging.basicConfig(filename="logfilename.log", level=logging.INFO)
# Log Creation

logging.info('your text goes here')
logging.error('your text goes here')
logging.debug('your text goes here')
Posted by: Guest on October-28-2020
6

logging.logger

import logging

logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
  
logger.debug("some debugging...")
logger.error("some error...")
Posted by: Guest on December-02-2020

Python Answers by Framework

Browse Popular Code Answers by Language