Showing the right funcName when wrapping logger functionality in a custom class

前端 未结 8 1886
你的背包
你的背包 2021-02-01 16:31

This is the formatting string that I am using for logging:

\'%(asctime)s - %(levelname)-10s - %(funcName)s - %(message)s\'

But to show the logg

8条回答
  •  你的背包
    2021-02-01 16:55

    You can merge progress method and split_line method:

    def progress(self, txt, *args, **kwargs):
        if self.isEnabledFor(self.PROGRESS):
            txt = txt % (args)
            for line in txt.split('\n'):
                self._log(self.PROGRESS, line, [], **kwargs)
    

提交回复
热议问题