Class Logger

Class Documentation

class Logger

Manages and logs outputs from GridKit code.

All methods and data in this class are static.

Public Types

enum Verbosity

Enum specifying verbosity level for the output.

Values:

enumerator NONE
enumerator ERRORS
enumerator WARNINGS
enumerator SUMMARY
enumerator EVERYTHING

Public Static Functions

static std::ostream &error()

Returns reference to output stream for error messages.

Returns:

Reference to error messages stream in output_streams_.

Pre:

output_streams_ vector is allocated and correctly initialized.

static std::ostream &warning()

Returns reference to output stream for warning messages.

Returns:

Reference to warning messages stream in output_streams_.

Pre:

output_streams_ vector is allocated and correctly initialized.

static std::ostream &summary()

Returns reference to analysis summary messages output stream.

Returns:

Reference to analysis summary messages stream in output_streams_.

Pre:

output_streams_ vector is allocated and correctly initialized.

static std::ostream &misc()

Returns reference to output stream for all other messages.

Returns:

Reference to output stream to miscellaneous messages in output_streams_.

Pre:

output_streams_ vector is allocated and correctly initialized.

static void setOutput(std::ostream &out)

Set outputs of active streams to user provided std::ostream object.

All active outputs are redirected to out stream. All inactive ones are directed to null device.

Parameters:

out[in] - User provided output stream.

Pre:

output_streams_ vector is allocated and correctly initialized.

Post:

All active streams (output_streams_[i] where i <= verbosity_) are set to user provided out output stream.

static void openOutputFile(std::string filename)

Open file filename and update outputs for different verbosities streams.

Parameters:

filename[in] - The name of the output file.

Pre:

output_streams_ vector is allocated and correctly initialized.

Post:

All active streams are directed to user supplied file filename.

static void closeOutputFile()

Close output file.

Pre:

Output file file_ has been opened.

Post:

Output file file_ is closed and active output streams are set to default output std::cout.

static void setVerbosity(Verbosity v)

Sets verbosity level.

Pre:

output_streams_ vector is allocated

Post:

Verbosity level is set to user supplied value v and outputs for output_streams_ are set accordingly.

static Verbosity verbosity()

Gets verbosity level.

static std::vector<std::ostream*> &init()

Delivers default values for output streams.