Created
December 16, 2015 19:48
-
-
Save ykhrustalev/98c88de698ea6f7b7e03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logger = None | |
def configure_loggging(): | |
global logger | |
fmt = logging.Formatter(logging.BASIC_FORMAT) | |
stream = logging.StreamHandler() | |
stream.setLevel(logging.DEBUG) | |
stream.setFormatter(fmt) | |
level = logging.WARNING | |
mem = logging.handlers.MemoryHandler(1024 * 10, level, target=stream) | |
mem.setLevel(logging.DEBUG) | |
root = logging.getLogger() | |
root.setLevel(logging.DEBUG) | |
root.addHandler(mem) | |
logger = logging.getLogger(__name__) | |
def main(): | |
configure_loggging() | |
logger.debug("debug message") | |
print "234" | |
logger.warn("warning") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment