Skip to content

Instantly share code, notes, and snippets.

@ykhrustalev
Created December 16, 2015 19:48
Show Gist options
  • Save ykhrustalev/98c88de698ea6f7b7e03 to your computer and use it in GitHub Desktop.
Save ykhrustalev/98c88de698ea6f7b7e03 to your computer and use it in GitHub Desktop.
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