The Vish Visualization Shell 0.3
Vish
Classes | Public Member Functions | Static Public Member Functions | List of all members
MemCore::VerboseStream Struct Reference

The class provides verbose printing of messages. More...

#include <elementary/memcore/Verbose.hpp>

Classes

struct  Indentator
 

Public Member Functions

VerboseStreamoperator<< (const std::type_info &Type)
 For types.
 

Static Public Member Functions

static std::string MemString (long long Mem)
 Convert some byte number to a string showing KiB, MiB and GiB.
 

Detailed Description

The class provides verbose printing of messages.

The operator '<<' is provided to add text to the stream. All kinds of objects can be added, if the 'std::string std::to_string( MyObject&M )' is defined.

A convenience macro 'Verbose(int i)' eases the use for messages, requiring an integer for the verbosity level. Messages are printed if the number is greater as a global defined verbosity level. The global level is defined by the environment variable: MEMCORE_VERBOSITY. e.g: In the source code:

Verbose(0) << "entered function"
Verbose(1) << "height = " << height;
Verbose(100) << "1";

In the shell:

export MEMCORE_VERBOSITY=5

Here, only the first two messages are printed, the third is filtered.

Messages with given level 0 are always printed. Messages with level < 0 also print the filename, line number and function name of the calling statement.

Usage: As a non-strict guideline the specified verbosity level shall have a range of 0 to 100. Messages in modules shall be <=50 and messages in libraries or in infrastructure code shall be >50.