MsPASS C++ API  2.4.1.dev4+g92330b7a
Defines the C++ API for MsPASS
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
mspass::utility::LogData Class Reference

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

#include <ErrorLogger.h>

Collaboration diagram for mspass::utility::LogData:
Collaboration graph
[legend]

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.

Friends And Related Symbol Documentation

◆ operator<<

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

Stream one log record to an output stream.

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: