Loading...
Searching...
No Matches
gpr::io::ErrorManager Class Reference

Responsible for errors handling. More...

#include <managers/io/ErrorManager.h>

Public Member Functions

 ErrorManager ()
 ~ErrorManager ()
template<typename T>
ErrorManager & operator<< (const T &data)
 Writes data to the log.

Static Public Member Functions

static void assertMsg (const bool expression, const std::string &message, const char *file, const char *func, const int line)
 Prints error message and terminates the program.

Detailed Description

Responsible for errors handling.

Definition at line 26 of file ErrorManager.h.

Constructor & Destructor Documentation

◆ ErrorManager()

gpr::io::ErrorManager::ErrorManager ( )
inline

Definition at line 28 of file ErrorManager.h.

28{ }

◆ ~ErrorManager()

gpr::io::ErrorManager::~ErrorManager ( )
inline

Definition at line 29 of file ErrorManager.h.

29{ }

Member Function Documentation

◆ assertMsg()

void gpr::io::ErrorManager::assertMsg ( const bool expression,
const std::string & message,
const char * file,
const char * func,
const int line )
inlinestatic

Prints error message and terminates the program.

Parameters
expressionCondition that must hold.
messageError message written when expression is false.
fileSource file containing the assertion.
funcFunction name.
lineLine number.

Definition at line 52 of file ErrorManager.h.

55 {
56 if (!expression) {
57 std::cerr << "[ " << file << "]::" << func << "::" << line << " "
58 << message << "\n";
59 exit(1);
60 }
61 }
std::string line(const std::string &topic, const std::vector< Field > &fields)

◆ operator<<()

template<typename T>
ErrorManager & gpr::io::ErrorManager::operator<< ( const T & data)
inline

Writes data to the log.

Parameters
dataData.
Returns
Reference to this.

Definition at line 37 of file ErrorManager.h.

38 {
39 // NOTE: logs to stderr; file logging uses LogManager
40 std::cerr << data;
41 return *this;
42 }

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