verbose

© 2016 John Abbott, Anna M. Bigatti
GNU Free Documentation License, Version 1.2



CoCoALib Documentation Index

Examples

User documentation

This file offers a simple facility for producing "verbose logging" of internal behaviour of algorithms. This is likely to be of interest to developers; the logging messages may also please anyone curious to know what is happening "behind the scenes".

There is a global "verbosity level": a non-negative integer whose default value is 0. Verbose logging messages specify the lowest level at which they will appear: e.g. a level-2 message will not appear if the global verbosity level is 0 or 1, but will appear if the level is 2 or higher.

Constructors and pseudo-constructors

There is just one constructor:

Setting and querying the verbosity level

There is just one query:

Operations

There is just one operation: let VERBOSE be a VerboseLog object

NOTE a verbose logging command will always evaluate its arguments (even if the logging command will produce no output because the global level is too low). It is best not to perform costly operations to produce logging output; if you must do so, then place a block of code inside the then-part of an if (IsVerbosityLevel(...)) {...} construct!

Maintainer documentation

Currently this is a very simplistic first implementation.

There are 3 globals:

Bugs, shortcomings and other ideas

Too simple?

Ideally the prefix containing fn name (and total nesting depth) should be printed at the start of each verbose log line; currently, it is printed just by the call VERBOSE(n) -- this works OK provided that only a single line is sent to that stream.

The name of DevNull is slightly misleading.

Perhaps later offer a way to suppress verbose logging messages when the nesting depth exceeds a limit?

Main changes

2016