src.ctf.fs: Add `LoggingItemVisitor`
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 21 May 2024 17:12:06 +0000 (13:12 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
commite7d9e96fbabb769550ec89eb28d304e66ce3abb6
tree7097ce27a62d73d0779bcf16b8b74db850e093c0
parentb7e890bb6c08e7cb5a36a8eaaabe5fc8bcc52dfd
src.ctf.fs: Add `LoggingItemVisitor`

While developing, I found it useful to print the sequence of items seen
by a given visitor, so I would make the various visitor methods print
some information.  Instead of re-implementing it in the various
visitors, I eventually extracted the functionality in its own visitor
(the one this patch adds).

This visitor logs details about the visited items.  Indentation is used
to represent the items that are logically nested in other ones.  For
example, everything between a ScopeBeginItem / ScopeEndItem pair gets
nested.

The logging is done unconditionally.  The intent is that the caller uses
something like:

  if (BT_LOG_ON_TRACE) {
      item.accept(loggingVisitor);
  }

to log at a given log level.

Philippe's changes:

* Add usage comments to `logging-item-visitor.hpp`.

* Move enumerator-to-string functions to `logging-item-visitor.cpp`.

* Move templates and everything `static` to `logging-item-visitor.cpp`.

* Log more details about some items.

* Reduce code redundancy.

* Use the standard Babeltrace 2 log statement format (therefore removing
  indentation).

* Log with BT_CLOGT() instead of BT_CLOGD().

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ie8a95217564bfbaa59f78793d7ba0b47aad1d882
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8202
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12711
src/Makefile.am
src/plugins/ctf/common/src/item-seq/item.hpp
src/plugins/ctf/common/src/item-seq/logging-item-visitor.cpp [new file with mode: 0644]
src/plugins/ctf/common/src/item-seq/logging-item-visitor.hpp [new file with mode: 0644]
This page took 0.024484 seconds and 4 git commands to generate.