Wiki

Clone wiki

logLog / Home

logLog

  • Fast, ring based embedded logging.
  • Log to rings that can wrap at various rates.
  • Don't perform string formatting in the target.
  • Store the format string "%d %s ..." only once.
$ hg clone https://bitbucket.org/darrell/loglog/wiki

Syntax highlighting

#include "logLog.h"

////////////////////////////////////////////
LogEntryId testLogId, logId2;

////////////////////////////////////////////
class MyLogger: public LogLog
{public:
    
    MyLogger(const char *name):LogLog(name)
    {
        init();
    }

    virtual void init()
    {
        NameSz ringInit[]={
            {"decoder", 200}, // 0
            {"myRing", 201}, // 1
            {"goodRing", 203}, // 2
            {(const char*)0,0}
        };

        initRings(ringInit);

        LogIdInit ids[]={
            {testLogId, "test1", 0/*decoderRing*/,1/*ring*/},
            {logId2, "id2", 0, 2},
            {logId2, 0, 0, 0}
        };

        initIds(ids);
    }  
};

////////////////////////////////////////////
MyLogger *logger;

////////////////////////////////////////////
void logSome()
{
    LOGS(testLogId) "FMT: %s %d %d %d 0x%X", "TEST", 1, 2, "::", 0x12345678 LOGE;
    LOGS(logId2) "%s %f 0x%X", "GO", 2.3, 0xFFFFFFFF LOGE;
    LOGS(testLogId) "0x%X", "RUN ", 0xF0F0F0F0 LOGE;
    LOGS(logId2) "%d ", 33 LOGE;
}

////////////////////////////////////////////
int main(int argc, char**argv)
{
    logger = new MyLogger("MyLogger");
    logSome();
    logger->dump();
    logger->upload();
    return 0;
}

Updated