Pantheios

Pantheios C/C++ Logging API Library
Stable release 1.0.1 (beta 214) / August 7, 2012 (2012-08-07)
Written in C/C++
Operating system MS-Windows, Unix, Mac OS X
Type Logging library
License BSD-form license
Website http://www.pantheios.org/

Pantheios is an open source C/C++ logging API library, whose design focus is performance, robustness and transparency. It claims 100% type-safety, and high efficiency.

Pantheios was forked from a proprietary logging architecture of Synesis Software in 2005, and is now completely free for use in both commercial and non-commercial activities, being licensed under the BSD license. It is platform-independent, working on UNIX (Linux, Solaris, FreeBSD), Mac OS X, and Windows (x86 and x64). It is compiler-independent, and is known to work with Borland, Metrowerks CodeWarrior, Comeau, Digital Mars, GCC, Intel, Sun Studio and Microsoft Visual C++ compilers.

Pantheios provides both C and C++ APIs. The C++ API is infinitely extensible to allowing logging of arbitrary types.

The API is designed to work with any logging transport (aka "back-end"), including existing logging libraries such as ACE and log4cxx.

Design Principles

The principles underpinning Pantheios are:

Architecture

The Pantheios architecture is divided into four functional areas:

Division of responsibilities

Use and customization of the library is divided between the library (and its authors) and users as follows:

Hello, World

Applying Pantheios to the classic Hello, World program gives the following examples:

1. Single argument of literal string

#include <pantheios/pantheios.hpp>

int main(int argc, char** argv)
{
  pantheios::log_NOTICE("Hello world");

  return EXIT_SUCCESS;
}

Notable aspects are:

2. Multiple arguments; different string types

#include <pantheios/pantheios.hpp>
#include <string>

int main(int argc, char** argv)
{
  const char  hello[] = "hello";
  std::string world("world");

  pantheios::log_NOTICE(hello, " ", world);

  return EXIT_SUCCESS;
}

Notable aspects are:

3. Logging an exception

#include <pantheios/pantheios.hpp>
#include <string>
#include <vector>

void say_hello()
{
  std::vector<short>   very_big(1000000000);

  throw std::runtime_error("hello world!");
}

int main(int argc, char** argv)
{
  try
  {
    say_hello();

    return EXIT_SUCCESS;
  }
  catch(std::bad_alloc&)
  {
    pantheios::logputs(PANTHEIOS_LOG_ALERT, "out of memory");
  }
  catch(std::exception& x)
  {
    pantheios::log_ERROR("Exception: ", x);
  }

  return EXIT_FAILURE;
}

Notable aspects are:

Dependencies

Pantheios is dependent on several open-source libraries:

Criticisms

Constrained by the design principles, Pantheios has attracted some criticisms, particularly in regard to its packaging and the complexity of its build: it builds many 10s of object libraries for a given target operating-system/compiler.

Other languages

Currently, the Pantheios developers are concerned primarily with C and C++. However, a COM project, Pantheios.COM, is also available from the project website. Furthermore, there are discussions about a D version, and other languages are under discussion.

References

  1. Wilson, Matthew (2004). Imperfect C++. Addison-Wesley. ISBN 0-321-22877-4.
  2. Wilson, Matthew (2007). Extended STL. Addison-Wesley. ISBN 0-321-30550-7.

Further reading

External links

This article is issued from Wikipedia - version of the Wednesday, February 04, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.