微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

RLog C++日志程序库

程序名称:RLog

授权协议: LGPL

操作系统: Windows

开发语言: C/C++

RLog 介绍

RLog是一个灵活的C++日志程序库。RLog高度优化了不用实际输出Log信息的分支,因此RLog可以留在发布产品中,并可以按需开启输出

示例代码

// create custom logging channel (part of debug hierarchy)
// Any subscriber to 'debug' will also pick up this sub channel,
// or it can be subscribed to directly.
static RLogChannel *timeChannel = DEF_CHANNEL("debug/timeStamp", Log_Debug);

void func(int foo)
{
    // log to the 'debug' channel
    rDebug("foo = %i", foo);
    int ans = 6 * 9;
    if(ans != 42)
        rWarning("ans = %i, expecting 42", ans); // log to warning channel
    // log to error channel
    rError("I'm sorry %s, I can't do that (error code %i)", name, errno);

    // log to custom channel
    // Note: time() never gets called unless there are subscribers to this message
    rLog(timeChannel, "the time is Now %i", (int)time(NULL));
}

RLog 官网

http://code.google.com/p/rlog/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐