반응형
import logging
import logging.config
import ctypes

# output "logging" messages to DbgView via OutputDebugString (Windows only!)
OutputDebugString = ctypes.windll.kernel32.OutputDebugStringW

class DbgViewHandler(logging.Handler):
    def emit(self, record):
        OutputDebugString(self.format(record))


fmt = logging.Formatter(fmt='%(asctime)s.%(msecs)03d [%(thread)5s] %(levelname)-8s %(funcName)-20s %(lineno)d %(message)s', datefmt='%Y:%m:%d %H:%M:%S')

ods = DbgViewHandler()
ods.setLevel(logging.DEBUG)
ods.setFormatter(fmt)    

logging.config.fileConfig("logging.conf")
logger = logging.getLogger()
logger.addHandler(ods)

logger.info('Start!!!!!!!')

 

 

 

참고 : https://gist.github.com/wh13371/92df4715fc17eb74299d

반응형

+ Recent posts