我将如何配置structlog,使包括info上面的所有消息都将使用KeyValueRenderer转到stdout,而所有日志记录也将使用JSONRenderer转到文件中
注意:我只想使用structlog,不使用标准库内容
发布于 2018-08-02 15:06:02
structlog不会开箱即用,您需要自己编写所需的代码。structlog是以一种简单明了的方式构建的,它应该有十几个LoC。
发布于 2018-08-01 08:54:22
如果您使用的是标准库日志,这应该非常简单,只使用配置。看看http://www.structlog.org/en/stable/standard-library.html#rendering-using-structlog-based-formatters-within-logging - ISTM中的日志配置示例,它会做一些类似的事情吗?
https://stackoverflow.com/questions/51627041
复制相似问题