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.
Platform macros and the core FIMS logging system.
- Copyright
- This file is part of the NOAA, National Marine Fisheries Service Fisheries Integrated Modeling System project. See LICENSE in the source folder for reuse information.
◆ FIMS_ERROR_LOG
| #define FIMS_ERROR_LOG |
( |
|
MESSAGE | ) |
|
Value:
__PRETTY_FUNCTION__);
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:270
The logging macro captures MESSAGE plus the call-site metadata (__LINE__, __FILE__, and __PRETTY_FUNCTION__) and forwards those values to error_message.
- Parameters
-
| MESSAGE | Human-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
-
| MESSAGE | Human-readable log message describing what happened and why. |
◆ FIMS_STR
Convert a preprocessor token to a string literal.
- Parameters
-
| s | Input 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
-
| MESSAGE | Human-readable log message describing what happened and why. |
◆ 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
-
| v | Value to convert to text using a string stream. |
- Returns
- String representation of
v.
◆ WriteAtExit()
| void fims::WriteAtExit |
( |
int |
sig | ) |
|
|
inline |
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
-
| sig | Integer 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). |