本文实例讲述了loggingExamples of module usage,Shared for your reference。The specific methods are as follows:
import logging import os log = () formatter = ('[%(asctime)s] [%(name)s] %(levelname)s: %(message)s') stream_handler = () file_handler = (("c:\\", "")) file_handler.setFormatter(formatter) stream_handler.setFormatter(formatter) (file_handler) (stream_handler) () ("a warning %s " % "c:\\")
The program runs with the following results:
[2014-09-29 10:23:58,905] [root] WARNING: a warning c:\
I hope that what I have said in this article will help you in your Python programming.