如何在boost log 2.0中记录编码器的行号? [英] How to log line number of coder in boost log 2.0?

查看:78
本文介绍了如何在boost log 2.0中记录编码器的行号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以为此使用LineID属性吗?
我希望我可以使用sink :: set_formatter来代替

Can I use LineID attribute for this? I hope I could use sink::set_formatter to do this instead of using

__LINE__

__FILE__

推荐答案

我为此苦苦挣扎,直到找到

I struggled with this, until I found this snippet

#define LFC1_LOG_TRACE(logger) \
BOOST_LOG_SEV(logger, trivial::trace) << "(" << __FILE__ << ", " << __LINE__ << ") "

像魅力一样工作

这篇关于如何在boost log 2.0中记录编码器的行号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆