|
CppNCorr
C++ ncorr Digital Image Correlation engine
|
Lightweight, dependency-free logging facility for CppNCorr. More...
#include <fstream>#include <mutex>#include <ostream>#include <sstream>#include <string>Go to the source code of this file.
Classes | |
| class | ncorr::log::Logger |
| Process-wide singleton logger. More... | |
| class | ncorr::log::Stream |
| RAII stream builder; flushes its accumulated text to the logger when it is destroyed at the end of the full expression. More... | |
| class | ncorr::log::Voidify |
| Helper that turns the conditional logging expression back into a void statement (glog idiom). More... | |
Namespaces | |
| namespace | ncorr |
| namespace | ncorr::log |
Macros | |
| #define | NLOG_AT(lvl) |
| #define | NLOG_TRACE NLOG_AT(::ncorr::log::Level::Trace) |
| #define | NLOG_DEBUG NLOG_AT(::ncorr::log::Level::Debug) |
| #define | NLOG_INFO NLOG_AT(::ncorr::log::Level::Info) |
| #define | NLOG_WARN NLOG_AT(::ncorr::log::Level::Warn) |
| #define | NLOG_ERROR NLOG_AT(::ncorr::log::Level::Error) |
Enumerations | |
| enum class | ncorr::log::Level { ncorr::log::Trace = 0 , ncorr::log::Debug = 1 , ncorr::log::Info = 2 , ncorr::log::Warn = 3 , ncorr::log::Error = 4 , ncorr::log::Off = 5 } |
| Severity levels, ordered from most to least verbose. More... | |
Functions | |
| Level | ncorr::log::level_from_string (const std::string &s, Level fallback=Level::Info) |
| Parse a level name (case-insensitive): trace, debug, info, warn|warning, error, off. | |
| const char * | ncorr::log::level_name (Level l) |
| Short, fixed-width display name for a level (e.g. "INFO "). | |
| void | ncorr::log::set_level (Level l) |
| Set the console threshold (convenience wrapper). | |
| void | ncorr::log::set_debug (bool on) |
Lower the console threshold to Debug when on is true (used to honour the engine's existing debug flag). | |
| bool | ncorr::log::set_file (const std::string &path) |
| Convenience: open a log file sink (full Debug detail). | |
| bool | ncorr::log::enabled (Level l) |
True if a message at l would be emitted by any sink. | |
Lightweight, dependency-free logging facility for CppNCorr.
CppNCorr is a static library consumed by other projects (e.g. CPPxDIC), so the logger is intentionally tiny and brings in no third-party dependency. It provides:
Because the library has no command line of its own, configuration is driven by environment variables (applied lazily on first use) and by the engine's existing debug flag:
NCORR_LOG_LEVEL trace|debug|info|warn|error|off (console threshold)NCORR_LOG_FILE path to a log file (full Debug detail is written)NCORR_LOG_CONSOLE 0|1|true|false (disable/enable console output)A parent application can also configure the logger programmatically via the helpers below before invoking the engine.
Definition in file log.h.
| #define NLOG_AT | ( | lvl | ) |
| #define NLOG_DEBUG NLOG_AT(::ncorr::log::Level::Debug) |
| #define NLOG_ERROR NLOG_AT(::ncorr::log::Level::Error) |
| #define NLOG_INFO NLOG_AT(::ncorr::log::Level::Info) |
| #define NLOG_TRACE NLOG_AT(::ncorr::log::Level::Trace) |
| #define NLOG_WARN NLOG_AT(::ncorr::log::Level::Warn) |