MsPASS C++ API  2.4.4.dev122+gb075c5a7b
Defines the C++ API for MsPASS
Loading...
Searching...
No Matches
mspass::utility::LogData Class Reference

One error-log record with provenance and severity. More...

#include <ErrorLogger.h>

Public Member Functions

 LogData ()
 LogData (const int jid, const std::string alg, const mspass::utility::MsPASSError &merr)
 LogData (const int jid, const std::string alg, const std::string msg, const mspass::utility::ErrorSeverity lvl)

Public Attributes

int job_id
int p_id
std::string algorithm
mspass::utility::ErrorSeverity badness
std::string message

Friends

std::ostream & operator<< (std::ostream &, LogData &)

Detailed Description

One error-log record with provenance and severity.

Constructor & Destructor Documentation

◆ LogData() [1/3]

mspass::utility::LogData::LogData ( )
inline

Construct an empty log record.

23{};

◆ LogData() [2/3]

mspass::utility::LogData::LogData ( const int jid,
const std::string alg,
const mspass::utility::MsPASSError & merr )

Normal constuctor from a MsPASSError or child of same.

Parameters
jidis the value to assign to job_id.
algis assigned to algorithm attribute.
merris parsed to fill the message and severity fields. Note p_id is always fetched with the system call getpid in the constructor.
8 {
9 job_id = jid;
10 p_id = getpid();
11 algorithm = alg;
12 message = merr.what();
13 badness = merr.severity();
14}
mspass::utility::ErrorSeverity badness
Definition ErrorLogger.h:20
int job_id
Definition ErrorLogger.h:17
std::string algorithm
Definition ErrorLogger.h:19
int p_id
Definition ErrorLogger.h:18
std::string message
Definition ErrorLogger.h:21
const char * what() const noexcept
Definition MsPASSError.h:100
ErrorSeverity severity() const
Definition MsPASSError.h:102

References algorithm, badness, job_id, message, p_id, mspass::utility::MsPASSError::severity(), and mspass::utility::MsPASSError::what().

◆ LogData() [3/3]

mspass::utility::LogData::LogData ( const int jid,
const std::string alg,
const std::string msg,
const mspass::utility::ErrorSeverity lvl )

Normal constuctor from strings.

Parameters
jidis the value to assign to job_id.
algis assigned to algorithm attribute.
msgis the error message.
lvlis the error severity. Note p_id is always fetched with the system call getpid in the constructor.
16 {
17 job_id = jid;
18 p_id = getpid();
19 algorithm = alg;
20 message = msg;
21 badness = lvl;
22}

References algorithm, badness, job_id, message, and p_id.

◆ operator<<

std::ostream & operator<< ( std::ostream & ,
LogData &  )
friend

Stream one log record to an output stream.

References algorithm, badness, job_id, LogData(), message, and p_id.

Member Data Documentation

◆ algorithm

std::string mspass::utility::LogData::algorithm

Algorithm or component that posted the message.

◆ badness

mspass::utility::ErrorSeverity mspass::utility::LogData::badness

Severity assigned to the message.

◆ job_id

int mspass::utility::LogData::job_id

Processing job identifier.

◆ message

std::string mspass::utility::LogData::message

Human-readable log message.

◆ p_id

int mspass::utility::LogData::p_id

Process id returned by getpid().


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