Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Simple Logging Library for C/C++ Programs
C Perl
tag: 2.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
config
src
srcutil
.gitignore
LICENSE
Makefile
README.pod
auto.c

README.pod

YOLOG

Yolog - Free Contextual Logging For All!

DESCRIPTION

Yolog is a small library (but not only a library) whose purpose is to provide a customizable and easy way for projects to log screen information.

Basically 'print-debugging' on steroids, Yolog provides contextual information with each message.

The following information can be obtained with each message

Thread Identification
Process Identification
Source File/Line/Function
User Defined Subsystem
Color-coded Severity Display

Yolog can be used as a DSO, or it can be embedded into your project with the genyolog.pl script.

Yolog can employ variadic macros as present in C99, or fallback to C89 mode with some clever tricks.

Yolog should be simple to use in your code:

DSO Version:

    #include <yolog.h>

    static void myfunc(void)
    {
        yolog_debug("This won't print because severity is too low");
        yolog_warn("But this will show a warning");
    }

    int main(void) {
        yolog_init_defaults(
            NULL, /* no specialized context */
            0, /* no contexts to count */,
            YOLOG_WARN, /* minimum severity level to log */
            "DEBUG", /* environment variable to control severity filtering */
            "DEBUG_COLOR" /* environment variable to control color output */
        );
        myfunc();
        return 0;
    }

Embedded Version:

    #include "yolog_out/myapp_yolog.h"
    static void myfunc(void)
    {
        myapp_debug("This won't print");
        myapp_warn("This will print a warning");
    }

    int main(void)
    {
        myapp_yolog_init();
        myfunc();
        return 0;
    }

The embedded Yolog generated source will configure logging functions which will have a namespace of your choosing prefixed to them. This avoids name clashes and makes it interoperable with any other logging module/wrapper you wish to use.

Something went wrong with that request. Please try again.