associação pythonbrasil[11] django zope/plone planet Início Logado como (Entrar)

Logging

  • exemplo de uso simples
    •    1 import logging
         2 log = logging.getLogger('sqlalchemy')
         3 log.addHandler(logging.StreamHandler())
         4 log.handlers[0].setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s"))
         5 log.setLevel(logging.DEBUG)
         6 
         7 log.debug("debug message")
         8 log.info("info message")
         9 log.warn("warn message")
        10 log.error("error message")
        11 log.critical("critical message")