def main(): dictLogConf = { "version": 1, "handlers": { "fileHandler": { "class": "logging.FileHandler", "formatter": "myFormatter", "filename": "config2.log" } }, "loggers": { "exampleApp": { "handlers": ["fileHandler"], "level": "INFO", } }, "formatters": { "myFormatter": { "format": "%(asctime)s -%(name)s - %(levelname)s - %(message)s" } } } logging.config.dictConfig(dictLogConf) logger = logging.getLogger("exampleApp") logger.info("Program started") result = otherMod2.add(7, 8) logger.info("Done")
def main(): """ Based on http://docs.python.org/howto/logging.html#configuring-logging """ dictLogConfig = { "version": 1, "handlers": { "fileHandler": { "class": "logging.FileHandler", "formatter": "myFormatter", "filename": "config2.log" } }, "loggers": { "exampleApp": { "handlers": ["fileHandler"], "level": "INFO", } }, "formatters": { "myFormatter": { "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s" } } } logging.config.dictConfig(dictLogConfig) logger = logging.getLogger("exampleApp") logger.info("Program started") result = otherMod2.add(22, 33) logger.info("Done!")
def main(): dictLogConfig = { "formatters": { "myFormatter": { "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s" } }, "handlers": { "fileHandler": { "class": "logging.FileHandler", "filename": "config2.log", "formatter": "myFormatter" } }, "loggers": { "exampleApp": { "handlers": ["fileHandler"], "level": "INFO" } }, "version": 1 } logging.config.dictConfig(dictLogConfig) logger = logging.getLogger('exampleApp') logger.info('program started') result = otherMod2.add(7, 8) logger.info('done!')
def main(): logging.config.fileConfig('logging.conf') logger = logging.getLogger("exampleApp") logger.info("Program started") result = otherMod2.add(7, 8) logger.info("Done")
def main(): logging.config.fileConfig('logging.conf') logger = logging.getLogger('exampleApp') logger.info('progress started') result = otherMod2.add(7, 8) logger.info('done!')
def main(): logging.config.fileConfig('logging.conf') logger = logging.getLogger('exampleApp') logger.info("Program start") result = otherMod2.add(4, 5) logger.info("Done")
def main(): """ Based on http://docs.python.org/howto/logging.html#configuring-logging """ logging.config.fileConfig('logging.conf') logger = logging.getLogger("exampleApp") logger.info("Старт программы") result = otherMod2.add(7, 8) logger.info("Отработала корректно")
def main(): """ Based on http://docs.python.org/howto/logging.html#configuring-logging """ logging.config.fileConfig('logging.conf') logger = logging.getLogger("exampleApp") logger.info("Program started") result = otherMod2.add(7, 8) logger.info("Done!")
def main(): logger=logging.getLogger("exampleApp") logger.setLevel(logging.INFO) fh=logging.FileHandler("new_snake.log") formatter=logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') fh.setFormatter(formatter) logger.addHandler(fh) logger.info("Program started") result=otherMod2.add(3,5) logger.info("Done")
def main(): logger = logging.getLogger("exampleApp") logger.setLevel(logging.INFO) fh = logging.FileHandler("new_water.log") formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') fh.setFormatter(formatter) logger.addHandler(fh) logger.info("Программа запустилась") result = otherMod2.add(7, 8) logger.info("Всё отработало корректно")
def main(): logger = logging.getLogger('exampleApp') logger.setLevel(logging.INFO) # create logger file handler fh = logging.FileHandler('new_snake.log') formatter = logging.Formatter('%(asctime)s - %(name)s -\ %(levelname)s - %(message)s') fh.setFormatter(formatter) # add handler to logger object logger.addHandler(fh) logger.info('program started') result = otherMod2.add(7, 8) logger.info('done!')
def main(): """The main entry point of the application.""" logger = logging.getLogger("exampleApp") logger.setLevel(logging.INFO) # create the logging file handler fh = logging.FileHandler("new_snake.log") formatter = logging.Formatter( "%(asctime)s - %(name)s - %(levelname)s - %(message)s") fh.setFormatter(formatter) # add handler to logger object logger.addHandler(fh) logger.info("Program started") result = otherMod2.add(7, 8) logger.info("Done!")
def main(): """ The main entry point of the application """ logger = logging.getLogger("exampleApp") logger.setLevel(logging.INFO) # create the logging file handler fh = logging.FileHandler("new_snake.log") formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') fh.setFormatter(formatter) # add handler to logger object logger.addHandler(fh) logger.info("Program started") result = otherMod2.add(7, 8) logger.info("Done!")
def main(): """ The main entry point of the application """ # logging.basicConfig(filename="sample1.log", level=logging.INFO) logger = logging.getLogger('exampleApp') logger.setLevel(logging.INFO) # create the logging file handler fh = logging.FileHandler('new_snake.log') formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') fh.setFormatter(formatter) # # add handler to logger object logger.addHandler(fh) logger.info("Program started") result = otherMod2.add(7, 8) logger.info("Done!")