Flow123d  release_2.2.1-10-gb9fad4d
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
LoggerOptions Class Reference

#include <logger_options.hh>

Collaboration diagram for LoggerOptions:
Collaboration graph
[legend]

Public Member Functions

int get_mpi_rank ()
 Returns number of actual process, if MPI is not supported returns -1. More...
 
int setup_mpi (MPI_Comm comm)
 Set rank of actual process by MPI communicator. More...
 
void set_log_file (std::string log_file_base)
 Initialize instance object in format 'log_file_base.process.log'. More...
 
void reset ()
 Reset MPI rank and log file name. More...
 
bool is_init ()
 Check if singleton instance object is initialize. More...
 
 ~LoggerOptions ()
 Destructor. More...
 

Static Public Member Functions

static LoggerOptionsget_instance ()
 Getter of singleton instance object. More...
 
static std::string format_hh_mm_ss ()
 

Private Member Functions

 LoggerOptions ()
 Forbidden constructor. More...
 

Private Attributes

std::ofstream file_stream_
 Stream for storing logger messages to file. More...
 
int mpi_rank_
 Actual process number. More...
 
bool no_log_
 Turn off logger file output. More...
 
bool init_
 Flag sign if logger is initialized by set_log_file method. More...
 

Static Private Attributes

static TimePoint start_time = TimePoint()
 Start time of program, allows you to specify the actual time of program (see format_hh_mm_ss method) More...
 
static LoggerOptionsinstance_ = new LoggerOptions()
 Singleton instance. More...
 

Friends

class Logger
 

Detailed Description

Helper class defined logger output file and flags for setting of logger.

Use singleton design pattern.

Setting of logger is ensured by two methods: setup_mpi and set_log_file. Both methods are optional.

Example of complete initialization of logger:

std::string log_file_prefix;
// ... set value of log_file_prefix

Definition at line 55 of file logger_options.hh.

Constructor & Destructor Documentation

LoggerOptions::~LoggerOptions ( )

Destructor.

Definition at line 77 of file logger_options.cc.

Here is the caller graph for this function:

LoggerOptions::LoggerOptions ( )
private

Forbidden constructor.

Definition at line 73 of file logger_options.cc.

Here is the caller graph for this function:

Member Function Documentation

std::string LoggerOptions::format_hh_mm_ss ( )
static

Return actual time from the beginning of application runtime in format HH:MM:SS.SSS

Definition at line 37 of file logger_options.cc.

Here is the caller graph for this function:

LoggerOptions & LoggerOptions::get_instance ( )
static

Getter of singleton instance object.

Definition at line 31 of file logger_options.cc.

Here is the caller graph for this function:

int LoggerOptions::get_mpi_rank ( )

Returns number of actual process, if MPI is not supported returns -1.

Definition at line 85 of file logger_options.cc.

Here is the caller graph for this function:

bool LoggerOptions::is_init ( )
inline

Check if singleton instance object is initialize.

Definition at line 79 of file logger_options.hh.

void LoggerOptions::reset ( )

Reset MPI rank and log file name.

Definition at line 119 of file logger_options.cc.

void LoggerOptions::set_log_file ( std::string  log_file_base)

Initialize instance object in format 'log_file_base.process.log'.

Definition at line 97 of file logger_options.cc.

Here is the caller graph for this function:

int LoggerOptions::setup_mpi ( MPI_Comm  comm)

Set rank of actual process by MPI communicator.

Definition at line 90 of file logger_options.cc.

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class Logger
friend

Definition at line 110 of file logger_options.hh.

Member Data Documentation

std::ofstream LoggerOptions::file_stream_
private

Stream for storing logger messages to file.

Definition at line 95 of file logger_options.hh.

bool LoggerOptions::init_
private

Flag sign if logger is initialized by set_log_file method.

Definition at line 108 of file logger_options.hh.

LoggerOptions * LoggerOptions::instance_ = new LoggerOptions()
staticprivate

Singleton instance.

Definition at line 92 of file logger_options.hh.

int LoggerOptions::mpi_rank_
private

Actual process number.

Default value is set to -1 and indicates that MPI is not set

Definition at line 102 of file logger_options.hh.

bool LoggerOptions::no_log_
private

Turn off logger file output.

Definition at line 105 of file logger_options.hh.

TimePoint LoggerOptions::start_time = TimePoint()
staticprivate

Start time of program, allows you to specify the actual time of program (see format_hh_mm_ss method)

Definition at line 89 of file logger_options.hh.


The documentation for this class was generated from the following files: