Flow123d
JB_release_tests-c4abd42
|
#include <logger_options.hh>
Public Types | |
enum | InitFlag { uninitialize , no_log , initialize } |
Initialization flag of Logger. More... | |
Public Member Functions | |
int | get_mpi_rank () const |
Returns number of actual process, if MPI is not supported returns -1. More... | |
void | set_mpi_rank (int mpi_rank) |
Set rank of actual process. More... | |
void | reset () |
Reset MPI rank and log file name. More... | |
LoggerOptions::InitFlag | init_flag () |
Check if singleton instance object is initialize. More... | |
void | set_stream (std::string abs_path) |
Set init_ flag. More... | |
std::string | log_file_name (std::string log_file_base) |
Create unique log file name. More... | |
~LoggerOptions () | |
Destructor. More... | |
Static Public Member Functions | |
static LoggerOptions & | get_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... | |
InitFlag | init_flag_ |
Flag sign if logger is initialized. 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 LoggerOptions * | instance_ = new LoggerOptions() |
Singleton instance. More... | |
Friends | |
class | Logger |
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:
Definition at line 57 of file logger_options.hh.
Initialization flag of Logger.
Enumerator | |
---|---|
uninitialize | |
no_log | |
initialize |
Definition at line 61 of file logger_options.hh.
LoggerOptions::~LoggerOptions | ( | ) |
Destructor.
Definition at line 78 of file logger_options.cc.
|
private |
Forbidden constructor.
Definition at line 74 of file logger_options.cc.
|
static |
Return actual time from the beginning of application runtime in format HH:MM:SS.SSS
Definition at line 38 of file logger_options.cc.
|
static |
Getter of singleton instance object.
Definition at line 32 of file logger_options.cc.
|
inline |
Returns number of actual process, if MPI is not supported returns -1.
Definition at line 76 of file logger_options.hh.
|
inline |
Check if singleton instance object is initialize.
Definition at line 87 of file logger_options.hh.
std::string LoggerOptions::log_file_name | ( | std::string | log_file_base | ) |
Create unique log file name.
Definition at line 93 of file logger_options.cc.
void LoggerOptions::reset | ( | ) |
Reset MPI rank and log file name.
Definition at line 126 of file logger_options.cc.
void LoggerOptions::set_mpi_rank | ( | int | mpi_rank | ) |
Set rank of actual process.
Definition at line 86 of file logger_options.cc.
void LoggerOptions::set_stream | ( | std::string | abs_path | ) |
Set init_
flag.
Definition at line 115 of file logger_options.cc.
|
friend |
Definition at line 121 of file logger_options.hh.
|
private |
Stream for storing logger messages to file.
Definition at line 109 of file logger_options.hh.
|
private |
Flag sign if logger is initialized.
Definition at line 119 of file logger_options.hh.
|
staticprivate |
Singleton instance.
Definition at line 106 of file logger_options.hh.
|
private |
Actual process number.
Default value is set to -1 and indicates that MPI is not set
Definition at line 116 of file logger_options.hh.
Start time of program, allows you to specify the actual time of program (see format_hh_mm_ss
method)
Definition at line 103 of file logger_options.hh.