Skip to content

Commit 23932b8

Browse files
authored
Merge pull request #3392 from sonodtt/doc-day-cprover-printing-overview
Basic placeholder information about cprover printing.
2 parents de0b481 + f5bd587 commit 23932b8

File tree

1 file changed

+58
-2
lines changed

1 file changed

+58
-2
lines changed

Diff for: src/util/README.md

+58-2
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ The deserialisation does the oposite process and it is implemented in
315315
\subsubsection irep-serialization-strings Serialization of Strings
316316

317317
A string is encoded as classic 0-terminated C string. However,
318-
characters `0` and `\\` are escaped by writing additional `\\`
319-
before them.
318+
characters `0` and `\\` are escaped by writing additional `\\`
319+
before them.
320320

321321
This is implmented in the function `::write_gb_string` and the
322322
deserialisation is implemented in `irep_serializationt::read_gb_string`.
@@ -329,3 +329,59 @@ serialisation queries save only that integer hash code of the string.
329329

330330
\subsubsection irep-serialization-ireps Serialization of `irept` Instances
331331

332+
<br>
333+
\subsection CProver-output CProver output - printing.
334+
335+
CProver output can be in plain text, json or xml format.
336+
All of CProver output should use the built-in messaging infrastructure,
337+
which filters messages by 'verbosity'. Default verbosity filtering is set
338+
to the maximum level (10), i.e. all messages are printed. Error messages
339+
have the lowest level of verbosity (level 1) while debug messages have
340+
the highest level (level 10). Intermediate levels (in order of
341+
increasing 'verbosity') are for warnings, results, status/phase information,
342+
statistical information and progress information
343+
(more information on these verbosity levels can be found in
344+
\ref messaget in the `message.h` header).
345+
346+
Key classes related to the messaging infrastructure can be found in
347+
the `message.h` header. \ref messaget provides messages (with a built-in
348+
verbosity level), which are then processed by subclasses
349+
of \ref message_handlert. These filter messages according to verbosity
350+
level and direct output to an appropriate location.
351+
An important group of subclasses is \ref stream_message_handlert and
352+
its subtypes, which direct messages to an output stream
353+
(`std::cout` & `std::cerr`, `std::clog` is not used). In particular,
354+
messages of verbosity level less than 3 are directed to `std::cerr`,
355+
while others go to `std::cout` (this may change, but you should be
356+
aware that not all messages are necessarily directed to only
357+
`std::cout` or `std::cerr`).
358+
Another key \ref message_handlert subclass is
359+
ui_message_handlert - which provides output in plain text,
360+
json or xml formats.
361+
362+
\subsubsection CProver-legacy-output CProver legacy output
363+
Although all output should use the messaging interface - there are a
364+
few locations where this is not yet implemented. These should
365+
_not_ be extended - but it may be helpful to be aware of where this happens.
366+
367+
* Output from invariants / exceptions
368+
369+
Invariants output to `std::cerr` - and provide a backtrace and optionally
370+
some diagnostic information.
371+
For more information on invariants, see `invariant.h`
372+
373+
Exceptions have a standard `what()` interface.
374+
Best current practice for exceptions is for the output of `what()` to be
375+
routed via a message with verbosity level 1 (as returned by
376+
`messaget::error()`). The message is then processed by a message_handler.
377+
Where plain text output (versus json or xml output) is
378+
chosen, exceptions print (indirectly) to `std::cerr`. Json and xml
379+
output always goes to `std::cout`. There are still a few locations where
380+
exceptions print directly to std::cerr. These should _not_ be extended.
381+
More information on exceptions can be found in `exception_utils.h`.
382+
383+
* Direct output via `std::cout` & `std::cerr`
384+
385+
These are in the process of being removed - no new output should go
386+
via `std::cout` or `std::cerr`, but should instead use the
387+
\ref messaget and \ref message_handlert infrastructure.

0 commit comments

Comments
 (0)