Skip to content

Instantly share code, notes, and snippets.

@wwj718
Last active September 1, 2015 05:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wwj718/f40f0572c6e099073238 to your computer and use it in GitHub Desktop.
Save wwj718/f40f0572c6e099073238 to your computer and use it in GitHub Desktop.
日志
#!/usr/bin/env python
# encoding: utf-8
import logging
LOG_FILE = "log_file.log"
#logging.basicConfig(filename=LOG_FILE,level=logging.DEBUG)
logger = logging.getLogger(__name__)
handler=logging.FileHandler(LOG_FILE)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
logger.debug("this is an debug message")
logger.info("This is an info message")
logger.warning("This is a warning message")
logger.error("This is an error message")
logger.critical("This is a critical message")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment