Advertisement

PythonLoggingNotesLogBook

阅读量:
复制代码
    import logging
    import os
    
    logging.basicConfig(
    format='[%(asctime)s] %(message)s', #  format 和 datefmt都要有。
    datefmt='%Y/%M/%d %H:%M:%S',
    level=logging.DEBUG,
    handlers=[
        logging.FileHandler(os.path.join('/home/you/you/chenwei/AdelaiDet/adet/modeling/MEInst/Decouple/', 'eval.log')),
        logging.StreamHandler()
    ]
    )
    
    logging.info("test for beginning")
    logging.info("test ok")
    
    
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
    
复制代码
    # output:
    
    [2021/3

全部评论 (0)

还没有任何评论哟~