This source file contains definitions of the types and constants to handle data types. More...
Namespaces | |
| namespace | datatype |
| This source file contains definitions of the types and constants to handle data types. | |
| namespace | defs |
| namespace | fits |
| This source file contains definitions of the types and constants to handle FITS. | |
| namespace | test |
| namespace | tools |
| Header file for the IFW Foundation Tools library. | |
Classes | |
| class | Logger |
| Abstract logger; downstream supplies an implementation. More... | |
| class | ScopedTracer |
RAII tracer used by FNDTRACE. More... | |
Enumerations | |
| enum class | LogLevel : int { TRACE = 0 , DEBUG = 10 , INFO = 20 , WARNING = 30 , ERROR = 40 , OFF = 100 } |
| Log severity, lowest to highest. More... | |
Functions | |
| void | InstallLogger (std::unique_ptr< Logger > logger) noexcept |
| Install the process-wide logger. | |
| Logger & | Log () |
| Access the installed logger. | |
| bool | HasLogger () noexcept |
true iff a logger has been installed. | |
| std::unique_ptr< Logger > | MakeStdoutLogger () |
| Factory: a logger that prints to stdout. | |
| std::unique_ptr< Logger > | MakeNullLogger () |
| Factory: a logger that discards everything. | |
| std::string_view | LogLevelName (LogLevel level) noexcept |
Render a LogLevel as a short uppercase string. | |
| std::string | IsoTimeNow (const int8_t precision) |
| std::string | ThreadName () |
| Return name of current thread. | |
| double | TimeSecs () |
| void | SleepSecs (const float sleep_time_in_seconds) |
| std::string | IsoTime (const double time_since_epoch, const uint8_t precision) |
| template<typename... Ts> | |
| std::string | VariantToString (const std::variant< Ts... > &var) |
| std::string | TraceExtra () |
Helper used by FNDTRACE. | |
| template<typename... Args> | |
| std::string | TraceExtra (fmt::string_view fmt_str, Args &&... args) |
This source file contains definitions of the types and constants to handle data types.
Inline function generating a location identifier: "<file>:<line>:<function>:<thread>".
|
strong |
|
noexcept |
true iff a logger has been installed.
Provided so that low-level code (signal handlers, destructors running during shutdown) can avoid raising on a missing logger.
|
noexcept |
Install the process-wide logger.
Must be called once, early in main(), before any ifw-fnd API call that may log. Ownership is transferred to ifw-fnd. Calling twice replaces the previous logger and destroys it.
|
inline |
Return the ISO8601 time based on the time since epoch, expressed in seconds/double.
| [in] | time_since_epoch | Time in seconds/double since epoch. |
| [in] | precision | Number of decimal places for the fractional part of the second. |
|
inline |
Return the ISO8601 time now.
| [in] | precision | Number of decimal places for the fractional part of the second. |
| Logger & ifw::fnd::Log | ( | ) |
Access the installed logger.
| std::runtime_error | if no logger has been installed. |
|
noexcept |
Render a LogLevel as a short uppercase string.
Returns "TRACE" / "DEBUG" / "INFO" / "WARNING" / "ERROR" / "OFF". Used by MakeStdoutLogger() and available for downstream implementations.
| std::unique_ptr< Logger > ifw::fnd::MakeNullLogger | ( | ) |
Factory: a logger that discards everything.
Useful for unit tests that want ifw-fnd to be silent without having to redirect stdout.
| std::unique_ptr< Logger > ifw::fnd::MakeStdoutLogger | ( | ) |
Factory: a logger that prints to stdout.
Format: "<level> <message>\n". Intended for standalone tools and unit tests, not for production deployments.
|
inline |
Sleep for the given period of time specified in seconds/double.
| [in] | sleep_time_in_seconds | Time in seconds to sleep. |
|
inline |
Return name of current thread.
|
inline |
Return the current time since epoch in seconds/double.
|
inline |
Helper used by FNDTRACE.
FNDTRACE() with no extra args returns "". With a format string (and optional args) returns the formatted result. Variadic templates handle the "first arg is format string" split that the C++ preprocessor can't do cleanly.
|
inline |
| std::string ifw::fnd::VariantToString | ( | const std::variant< Ts... > & | var | ) |