如何在C ++中创建日志? [英] How to create a Log in C++?

查看:69
本文介绍了如何在C ++中创建日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用C ++打印很多调试日志.

I want to print lots of debug log prints in C++. Is there a built-in library that will allow me to turn on/off these prints without commenting them out as I do today (i.e., let the user use a -print_log/-debug flag)?

编辑:欢迎第三方记录器.

EDIT: third party loggers will be welcomed.

请提供一个简短的示例.

Please include a short example of how to do this.

推荐答案

如果您使用的是Boost,请考虑使用建议的

If you're using Boost, consider using the proposed Boost.Log library. It's not yet part of the official Boost release, but I've found it to be quite good. Manually integrating it into the Boost build process was a little challenging though.

这篇关于如何在C ++中创建日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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