Main Page | Modules | Class Hierarchy | Compound List | File List | Compound Members | Related Pages

RLog - a C++ logging library

1.3

Copyright © 2002-2004 Valient Gough < vgough @ pobox . com >

Distributed under the GPL license, see COPYING for details.

Introduction

RLog provides a flexible message logging facility for C++ programs and libraries. It is meant to be fast enough to leave in production code.

RLog provides macros which are similar to Qt's debug macros, which are similar to simple printf() statements:

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

The difference to Qt's macros is that the log messages are considered publishers and there can be any number of subscribers to log messages. Subscribers may choose which messages they want to receive in a number of different ways:

If there are no subscribers to a particular logging statement, that statement can be said to be dormant. RLog is optimized to minimize overhead of dormant logging statements, with the goal of allowing logging to be left in release versions of software. This way if problems show up in production code, it is possible to activate logging statements in real time to aid debugging.

As an indication of just how cheap a dormant logging statement is, on a Pentium-4 class CPU with g++ 3.3.1, a dormant log in a tight loop adds on the order of 2-6 (two to six) clock cycles of overhead (1). By comparison a simple logging function such as Qt's qDebug() adds about 1000 (a thousand) clock cycles of overhead - even when messages are being thrown away.

In addition, logging statements in RLog can be individually activated at run-time without affecting any other statements, allowing targeted log reporting.

(1) The first time a logging statement is encountered, it must be registered in order to determine if there are any subscribers. So there is additional overhead the first time a statement is encountered.

Using RLog

In order to begin using RLog in your code, you should do the following:

Requirements

RLog is known to work on the following:

To build development versions, you will also need the GNU autoconf tools (with automake and libtool). Documentation is built using Doxygen.

Downloads

RLog is available in source code and RPM packaged binaries for some systems.

RLog Version 1.3.1 - March 13, 2004 release.

RLog Version 1.3 - Feb 12, 2004 release.

To check the signature, you can download my public key from a public key server, or from the link at the top of my homepage.


Generated on Sun Mar 14 14:49:49 2004 for rlog by doxygen 1.3.2