python logger module code example

Example 1: 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')

Example 2: 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...")

Example 3: python fme logger

logger = fmeobjects.FMELogFile()
logger.logMessageString("{}".format('Error'), fmeobjects.FME_ERROR)

Tags:

Misc Example