Logger from the p≡p JSON Server Adapter as separate project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
roker cddafe4c76
implement toggle() which was missing for whatever reason. :-O
1 year ago
html implement toggle() which was missing for whatever reason. :-O 1 year ago
src make the unittest much more comprehensive and show the different usages of the Logger, and add some comments to explain things. :-) 1 year ago
.gitignore Added libpEpwebserver/Release/* and libpEpwebserver/Debug/* to .gitignore 2 years ago
COPYING Add files forgotten in last commit 6 years ago
README.md add reference to unittest_logger.cc to document usage of the Logger. 1 year ago


p≡p Logger


The p≡p Logger is a fork of the Logger module of the p≡p JSON Server Adapter.


  • compile-time configurable via logger_config.hh, run-time configuable via API functions

  • supports logging to syslog (UN*X only), to a file and to the console (stderr).

  • supports log levels ("severities" in syslog terminology) and run-time filtering of log entries lower than given "log level"

  • API for both printf()-like ("C") style and C++ outputstream-like style

  • compile-time disabling of debug messages via -D DEBUG_ENABLED (if done via macros, see below)

  • hierarchical Logger instances that inherit their "name" and their log level from their parent Logger instance

  • multi-line log messages, visualized via big square brackets

  • auto wrapping of long log lines, visualized via "↩" and "↪" (configurable at run-time via Logger::setMaxLineLength() )

  • log GMT / UTC timestamp and easily greppable thread IDs. The thread IDh have the form ¶XYZ where 'XYZ' is a hash of std::this_thread::get_id(), truncated to three base-37 digits, to make collisions of thread IDs unlikely.

  • logfile analyzer (e.g. for filtering log of different threads) via HTML & Javascript, see html/logview.html


  • truncating of pathologically long log messages, visualized via "▒ (%u octets clipped)" (configurable at run-time via Logger::setMaxMessageLength() )

  • escaping of non-printing control characters, illegal Unicode codepoints and illegal UTF-8 sequences



  • C++14 compiler: tested with clang++ 10, g++ 11. Newer versions should work, too.
  • GNU make

Building/Installing (Linux and macOS)

It is so simple. This should do out of the box:

make test

Building/Installing (Windows)


Using the Logger in your own code

See examples in src/unittest_logger.cc