[Dune-devel] A proper logging subsystem for Dune

Steffen Müthing steffen.muething at iwr.uni-heidelberg.de
Wed Feb 13 13:32:36 CET 2019


Hi everyone,

I’ve been recently been annoyed (again) by the state of console message output in Dune and fought with the
usual problems (setting verbosities, disabling output on rank > 0, long and complicated output formatting).

So I bit the bullet and wrote a little logging system that among others does the following:
- Adds cheap logger objects that do the output filtering (log levels are set at runtime).
- Uses Python-like format strings for output formatting (based on https://fmtlib.net, currently expected to
  become part of C++2a as P0645. Format strings are optionally syntax-checked at compile time. Together
  with the loggers, this makes log calls much less verbose than what we have now.
- Configurable routing for log messages: Each logger is attached to a backend singleton (of which there can
  be several), which is in turn attached to one or more sinks that actually write the log messages somewhere.
- Completely configurable via ParameterTree with usable defaults.
- Optional support for redirecting std::cout and std::cerr through the logging system for integration with legacy
  code.

The code is currently a MR in PDELab because it vendors fmtlib and uses a number of compiler features that
are C++17 only such as string_view, structured bindings, class template argument deduction, which make it a
difficult proposition for the core modules:

https://gitlab.dune-project.org/pdelab/dune-pdelab/merge_requests/393

That said, I would really like something like this in the core modules (maybe after ironing out the kinks in PDELab
for a release cycle), so if you are interested, please take a look at it!

Cheers
Steffen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20190213/fc21d7fa/attachment.sig>


More information about the Dune-devel mailing list