예제 #1
0
 def initlog(**kwargs):
     try:
         if kwargs["logfile"]:
             logFilePath = kwargs["logfile"]
             
             logging.basicConfig(level=logging.INFO,
                     format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                     datefmt='%m-%d %H:%M:%S',
                     filename=logFilePath,
                     filemode='aw')
             console = logging.StreamHandler()
             console.setLevel(logging.INFO)
             formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
             console.setFormatter(formatter)
             logging.getLogger('').addHandler(console)
     except:
         print printErrorInfo()
예제 #2
0
 def getLogging(name):
     try:
         return logging.getLogger(name)
     except:
         print printErrorInfo()