天天看点

POCO日志组件Tips

1、不要频繁调用Logger::get() ,而应总是调用1次,存储引用,使用引用;

You should avoid calling Logger::get() frequently. It's much better 

to call it once for every logger you're going to use, and then store 

the reference to the logger for later use.

2、总是检查消息是否会被输出,如果不被输出就不要构建消息。poco预定义的宏解决了这个问题。

There are also macros that do the check before constructing the 

message:

poco_fatal(msg), poco_critical(msg), poco_error(msg), etc.