import logging
"""Vamos praticar o sistema de logging do Python"""
log = logging.getLogger(__name__)# __name__ mostra o modulo, classe e funcao
# configuracao basica
logging.basicConfig(level=logging.INFO)
# create a file handler
arquivo = logging.FileHandler('C:/Users/LG/Desktop/logging_python/debug.log', 'a')
log.addHandler(arquivo) # adiciona as messagens de logging no meu log
class soma_sub():
log.info("classe importada!")
def __init__(self, x, y):
self.x = x
self.y = y
def soma(self):
return self.x + self.y
result = soma_sub(10,11)
log.info("instancia importada!")
result.soma()
print(result.soma())