Stable release | 1.0.1 (beta 214)
/ August 7, 2012 |
---|---|
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 (a.k.a. "back-end"), including existing logging libraries such as ACE and log4cxx.
The principles underpinning Pantheios are:
main()
The Pantheios architecture is divided into four functional areas:
Use and customization of the library is divided between the library (and its authors) and users as follows:
Applying Pantheios to the classic Hello, World program gives the following examples:
#include <pantheios/pantheios.hpp> int main(int argc, char** argv) { pantheios::log_NOTICE("Hello world"); return EXIT_SUCCESS; }
Notable aspects are:
pantheios/pantheios.hpp
pantheios::log_NOTICE()
application layer function, which causes the statement to be emitted at the PANTHEIOS_SEV_NOTICE
(=== 5, a.k.a. Syslog's LOG_NOTICE
) severity level"Hello world!"
to pantheios::log_NOTICE()
#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:
#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:
pantheios::log_ERROR()
application layer function, which causes the statement to be emitted at the PANTHEIOS_SEV_ERROR
(=== 3, a.k.a. Syslog's LOG_ERR
) severity levelpantheios::logputs()
application layer function, which passes a single C-style string directly through to the logging infrastructure and is suitable for logging low-memory conditions, at the PANTHEIOS_SEV_ALERT
(=== 1, a.k.a. Syslog's LOG_ALERT
) severity levelstd::exception
directly to the API; Pantheios uses shims to interpret the argument types and render them as stringsPantheios is dependent on several open-source libraries:
pantheios::b64
inserter class. It is bundled with the Pantheios distributionConstrained 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.
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.