FIMS  v0.9.2
Loading...
Searching...
No Matches
def.hpp File Reference

Platform macros and the core FIMS logging system. More...

#include <fstream>
#include <map>
#include <memory>
#include <vector>
#include <string>
#include <unordered_map>
#include <cstdlib>
#include <chrono>
#include <sstream>
#include <iostream>
#include <filesystem>
#include <stdlib.h>
#include <signal.h>
#include <csignal>
#include <cstring>
#include <stdexcept>

Go to the source code of this file.

Classes

struct  fims::LogEntry
 A data structure with defined fields for a single log record. More...
 
class  fims::FIMSLog
 Singleton logger for FIMS. More...
 

Macros

#define FIMS_INFO_LOG(MESSAGE)
 Record an info-log entry with metadata.
 
#define FIMS_WARNING_LOG(MESSAGE)
 
#define FIMS_ERROR_LOG(MESSAGE)
 
#define FIMS_STR(s)   #s
 Convert a preprocessor token to a string literal.
 

Functions

void fims::WriteAtExit (int sig)
 Signal handler that records a terminal error and flushes log entries.
 
template<typename T >
std::string fims::to_string (T v)
 

Detailed Description

Platform macros and the core FIMS logging system.

Macro Definition Documentation

◆ FIMS_ERROR_LOG

#define FIMS_ERROR_LOG (   MESSAGE)
Value:
static std::shared_ptr< FIMSLog > fims_log
A singleton instance of the log, i.e., where there is only one log. The object is created when the ....
Definition def.hpp:263
void clear_internal()
Clears the internal objects.
Definition rcpp_interface.hpp:235

The logging macro captures MESSAGE plus the call-site metadata (__LINE__, __FILE__, and __PRETTY_FUNCTION__) and forwards those values to error_message.

Parameters
MESSAGEHuman-readable log message describing what happened and why.

See also
FIMS_INFO_LOG
FIMS_WARNING_LOG
error_message()
info_message()
warning_message()

◆ FIMS_INFO_LOG

#define FIMS_INFO_LOG (   MESSAGE)
Value:

Record an info-log entry with metadata.

The logging macro captures MESSAGE plus the call-site metadata (__LINE__, __FILE__, and __PRETTY_FUNCTION__) and forwards those values to info_message.

Parameters
MESSAGEHuman-readable log message describing what happened and why.

◆ FIMS_STR

#define FIMS_STR (   s)    #s

Convert a preprocessor token to a string literal.

Parameters
sInput text from the macro that will be converted to a string.

◆ FIMS_WARNING_LOG

#define FIMS_WARNING_LOG (   MESSAGE)
Value:

The logging macro captures MESSAGE plus the call-site metadata (__LINE__, __FILE__, and __PRETTY_FUNCTION__) and forwards those values to warning_message.

Parameters
MESSAGEHuman-readable log message describing what happened and why.

Function Documentation

◆ to_string()

template<typename T >
std::string fims::to_string ( T  v)

Converts an object T to a string.

The object v of type T must be able to be written to a std::ostream with the << operator.

Parameters
vValue to convert to text using a string stream.
Returns
String representation of v.

◆ WriteAtExit()

void fims::WriteAtExit ( int  sig)

Signal handler that records a terminal error and flushes log entries.

On receipt of a supported signal, this function appends an error-level entry, writes the full log if write_on_exit is enabled, restores the default signal handler, and re-raises the signal.

Parameters
sigInteger signal identifier provided by the operating system when this handler is called (for example, SIGSEGV for invalid memory access, SIGINT for an interrupt such as Ctrl+C, or SIGTERM for a termination request).