|
1 year ago | |
---|---|---|
html | 1 year ago | |
src | 1 year ago | |
.gitignore | 2 years ago | |
COPYING | 6 years ago | |
README.md | 1 year ago |
README.md
p≡p Logger
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 ofstd::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)
It is so simple. This should do out of the box:
make test
Building/Installing (Windows)
TODO.
Using the Logger in your own code
See examples in src/unittest_logger.cc