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.
 
 
 
 
Marcel Schneider b7c43d44b8 Build: Fix strlcat on Linux. 4 weeks ago
PublicHeaders IPS-139 - clang formated 2 months ago
build-linux IPS-139 - clang formated 2 months ago
build-mac IPS-139 - clang formated 2 months ago
src Build: Fix strlcat on Linux. 4 weeks ago
.gitignore IPS-139 - add logger 2 months ago
LICENSE Initial commit 2 months ago
Makefile IPS-139 - add logger 2 months ago
README.md IPS-139 - add logger 2 months ago
clang-format.txt IPS-139 - add logger 2 months ago
clang-tidy.txt IPS-139 - add logger 2 months ago
local.conf.example IPS-139 - add logger 2 months ago

README.md

p≡p Logger

Resources

Requirements & Platforms

  • License: GPL3
  • C++ standard: C++11 (or newer, but consider portability)
  • supported compilers: gcc/clang (must be supported at least)
  • Build sytem: GNU Make (Linux, macOS)

Coding conventions

  • Code-formatting: use clang-format (Please try to use the .clang-format with the least necessary changes (maintainability and consistency within pEp))
  • static-analysis: use clang-tidy (Please try to use the .clang-tidy with the least necessary changes (maintainability and consistency within pEp))

Introduction

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

Features

  • 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

TODOs

  • 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

Building

Dependencies

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

Building/Installing (Linux and macOS)

TODO.

Building/Installing (Windows)

TODO.

Using the Logger in your own code

See examples in src/unittest_logger.cc