Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Python 结构日志。一切都记录为
event='Something Happened'
我不想要那个 event 关键字,我只想记录事件数据:
'Something happened'
我如何实现这一目标?
您始终可以编写一个自己的渲染器,只注销事件而无需其他任何东西:
>>> def renderer(logger, name, event_dict): ... return event_dict["event"] ... >>> import structlog >>> structlog.configure(processors=[renderer]) >>> structlog.get_logger().msg("look, no struct!") look, no struct!