Mercurial > hg > sworduploader
view sword2-libraries-pyinstaller-compatible/sword2/sword2_logging.py @ 22:d1752c7031e4 timeouts tip
Updated .hgignore to ignore sword2_logging.conf and anything in .cache
author | Steve Welburn <stephen.welburn@eecs.qmul.ac.uk> |
---|---|
date | Tue, 22 Jan 2013 14:43:42 +0000 |
parents | 8b69bba225c9 |
children |
line wrap: on
line source
#!/usr/bin/env python # -*- coding: utf-8 -*- """ `sword2` logging """ import logging import logging.config from os import path as os_path SWORD2_LOGGING_CONFIG = "./sword2_logging.conf" # default BASIC_CONFIG = """[loggers] keys=root [handlers] keys=consoleHandler [formatters] keys=basicFormatting [logger_root] level=INFO handlers=consoleHandler [handler_consoleHandler] class=StreamHandler level=DEBUG formatter=basicFormatting args=(sys.stdout,) [formatter_basicFormatting] format=%(asctime)s - %(name)s - %(levelname)s - %(message)s """ def create_logging_config(pathtologgingconf): fn = open(pathtologgingconf, "w") fn.write(BASIC_CONFIG) fn.close() if not os_path.isfile(SWORD2_LOGGING_CONFIG): create_logging_config(SWORD2_LOGGING_CONFIG) logging.config.fileConfig(SWORD2_LOGGING_CONFIG)