Project Description
The C++ Logging Toolkit Library is a simple to use, low overhead, high performance no frills logging library designed to be used within a multi-threaded context.

Download
http://www.partow.net/programming/logtk/index.html


Compatability
The C++ Logging Toolkit Library implementation is compatible with the following C++ compilers:
  • GNU Compiler Collection (4.1+)
  • Intel® C++ Compiler (9.x+)
  • Clang/LLVM (1.1+)
  • PGI C++ (10.x+)
  • Microsoft Visual Studio C++ Compiler (8.1+)
  • Comeau C++ Compiler (4.3+)
  • IBM XL C/C++ (10.x+)

Simple Example
The following example will instantiate the logger, log various messages, then proceed to stop and tear down the logger.

#include "logtk.hpp"

int main()
{
   using namespace logtk;

   start_logger("my_log",".");

   log("Before loop");
   for (std::size_t i = 0; i < 10; ++i)
   {
      log("log[%03d] Something...",i);
   }
   log("After loop");

   stop_logger();

   return 0;
}



Performance Benchmark
The following will attempt to perform an extreme load test upon the logger. The process will instantiate a logger, then proceed to create 12 threads, each of which will generate one million lines of logs comprised of elements which include strings, doubles, arrays and counters. Once complete, the total time taken and logs/sec rate will be printed to stdout.


#include <iostream>
#include <string>
#include <cmath>

#include "logtk.hpp"

int main()
{
   const std::string log_name = "logtk_example";
   const std::string path     = ".";

   if (!logtk::start_logger(log_name,path))
   {
      std::cerr << "ERROR - Failed to start logger!\n";
      return 1;
   }

   logtk::test::run(12,1000000);

   if (!logtk::stop_logger())
   {
      std::cerr << "ERROR - Failed to stop logger!\n";
      return 1;
   }

   return 0;
}


Last edited Jan 10, 2014 at 4:10 AM by ArashPartow, version 3