TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::Streams Class Reference

#include <Streams.h>

Static Public Member Functions

static void setStdMuteOut ()
 
static void setStdMuteErr ()
 
static void openLog (std::string filename="TBTKLog")
 
static void closeLog ()
 
static bool logIsOpen ()
 

Static Public Attributes

static std::ostream out
 
static std::ostream log
 
static std::ostream err
 

Detailed Description

Streams for TBTK output.

The Streams class provides global functions for streaming text output. By default the information is written to stdout and atderr, but the Streams class allows for more customized output. All text output from TBTK is written through the Stream interface, and can therefore be customized through it.

Streams::out

This is the standard output in TBTK. By default, information written to Streams::out is forwarded to std::cout and Streams::log.

Streams::err

This is the error output in TBTK. By default, information written to Streams::err is forwarded to std::err and Streams::log.

Streams::log

This is the logged output in TBTK. By default, the log does not write to anything. However, The two commands

Streams::openLog("LogFilename");

and

can be used to open and close a log file to which everything is written.

When the log is opened, a time stamp, version number, and git hash for the currently installed version of TBTK is added to the output. Similarly, a time stamp is added when the log is closed. This makes it easy to document the exact setup used to perform a calculation and provides a way for ensuring that the results will be possible to reproduce any time in the future.

Member Function Documentation

◆ closeLog()

static void TBTK::Streams::closeLog ( )
static

Close log.

◆ logIsOpen()

static bool TBTK::Streams::logIsOpen ( )
static

Returns true if the standard log file is open.

◆ openLog()

static void TBTK::Streams::openLog ( std::string  filename = "TBTKLog")
static

Open log.

Parameters
filenameThe filename of the log file.

◆ setStdMuteErr()

static void TBTK::Streams::setStdMuteErr ( )
static

Mute error stream.

◆ setStdMuteOut()

static void TBTK::Streams::setStdMuteOut ( )
static

Mute output stream.

Member Data Documentation

◆ err

std::ostream TBTK::Streams::err
static

Error output stream.

◆ log

std::ostream TBTK::Streams::log
static

Detailed log output stream.

◆ out

std::ostream TBTK::Streams::out
static

Standard output stream.


The documentation for this class was generated from the following file:
TBTK::Streams::openLog
static void openLog(std::string filename="TBTKLog")
TBTK::Streams::closeLog
static void closeLog()