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")
Ejemplo n.º 2
0
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!")
Ejemplo n.º 3
0
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!')
Ejemplo n.º 4
0
def main():
    logging.config.fileConfig('logging.conf')
    logger = logging.getLogger("exampleApp")

    logger.info("Program started")
    result = otherMod2.add(7, 8)
    logger.info("Done")
Ejemplo n.º 5
0
def main():
    logging.config.fileConfig('logging.conf')
    logger = logging.getLogger('exampleApp')

    logger.info('progress started')
    result = otherMod2.add(7, 8)
    logger.info('done!')
Ejemplo n.º 6
0
def main():
    logging.config.fileConfig('logging.conf')
    logger = logging.getLogger('exampleApp')

    logger.info("Program start")
    result = otherMod2.add(4, 5)
    logger.info("Done")
Ejemplo n.º 7
0
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("Отработала корректно")
Ejemplo n.º 8
0
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!")
Ejemplo n.º 9
0
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!")
Ejemplo n.º 10
0
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")
Ejemplo n.º 11
0
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("Всё отработало корректно")
Ejemplo n.º 12
0
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!')
Ejemplo n.º 13
0
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!")
Ejemplo n.º 14
0
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!")
Ejemplo n.º 15
0
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!")