Python logger, print child logger %(name) without parent name

前端 未结 2 1156
我寻月下人不归
我寻月下人不归 2021-01-21 04:58

I am trying Python logging.

Since I want some logger to share a formatter, I use hierarchy of logging like the below code.

As you can see, format is \'%(as

2条回答
  •  误落风尘
    2021-01-21 05:29

    If you want the name to say 'bar' instead of 'foo.bar', just log to a logger named 'bar', and add your handlers to the root logger.

提交回复
热议问题