【发布时间】:2010-12-24 21:14:05
【问题描述】:
我认为将 boost::singleton 与 boost::logger 一起使用是有意义的,这样可执行文件中的所有对象都可以访问同一个记录器并将字符串转储到它。
class logger_singleton
: public boost::mutexed_singleton<logger_singleton>
{
private
boost::logger blogger;
public:
logger_singleton(boost::restricted);
// public interface, e.g:
int log_this_string(const std::string &a){blogger->strm()<<a;}
};
有没有人试过这个,你怎么看?
【问题讨论】:
-
现在有 boost::singleton 了吗?这是最近添加的吗?
标签: c++ boost singleton logging