| Home | API Documentation |
Internal: Mug · ThorsMug · ThorsSlack · NisseServer · NisseHTTP · ThorsSocket · ThorsCrypto · ThorsSerializer · ThorsMongo · ThorsLogging · ThorsIOUtil
Implementation details, macro machinery, and build-mode internals for the ThorsLogging library.
Source: third/ThorsLogging/src/ThorsLogging/
The entire public surface is in a single header: ThorsLogging.h. There are no additional .cpp files; the implementation is entirely macro- and inline-based.
ThorsLogging.h <-- Public API (macros + ThorsLogTemp class)
ThorsLoggingConfig.h <-- Generated build configuration
third/loguru/ThorsAnvil::Utility::buildErrorMessage() for formatting all log messagesControlled by the preprocessor symbol THORS_LOGGING_HEADER_ONLY:
| Mode | THORS_LOGGING_HEADER_ONLY |
Backend | Notes |
|---|---|---|---|
| Linked | 0 or undefined |
loguru | Full loguru functionality; requires linking against loguru. |
| Header-only | 1 |
std::cerr |
No link dependency. Minimal loguru::NamedVerbosity enum provided. |
In header-only mode, THOR_LOGGING_DEFAULT_LOG_LEVEL (default: 3) determines which messages are emitted. Messages with verbosity numerically greater than this threshold are suppressed at compile time.
Inherits loguru’s verbosity model. Lower numeric values are more severe:
| Named Level | Numeric | Macro Suffix |
|---|---|---|
FATAL |
-3 | Fatal |
ERROR |
-2 | Error |
WARNING |
-1 | Warning |
INFO |
0 | Info |
| (debug) | 3 | Debug |
| (track) | 5 | Track |
| (trace) | 7 | Trace |
| (all) | 9 | All |
Special values:
Verbosity_OFF (-9) – suppress all outputVerbosity_INVALID (-10) – sentinel; never log at this levelThorsLogActionWithPotetialThrow(hasExcept, Exception, Level, Scope, Function, ...)
When hasExcept is true, it logs and throws. When false, it only logs. The throw path uses if constexpr so it is compiled away when not needed.
ThorsLogAction(...) – calls core macro with hasExcept=false and Exception=std::runtime_error (unused).ThorsLogAndThrowAction(...) – calls core macro with hasExcept=true.All messages are formatted via ThorsAnvil::Utility::buildErrorMessage(...) which concatenates all variadic arguments using operator<< to a std::ostringstream.
When THORS_LOGGING_HEADER_ONLY == 1:
A helper class whose operator&(std::ostream&) discards the stream expression. Used by VLOG_IF_S to conditionally suppress output at compile time.
Expands to either (void)0 (suppressed) or std::cerr (active), based on verbosity and condition.
Shorthand for VLOG_IF_S(verbosity, true).
Writes to std::cerr if the level is within threshold.
In header-only mode, ThorsLogTemp is a no-op (constructor/destructor do nothing).
In linked mode, the macros delegate to loguru’s VLOG_S / LOG_F macros, which provide:
ThorsLogFatal causes the application to abort via loguru’s FATAL handling.
| Symbol | Default | Description |
|---|---|---|
THORS_LOGGING_HEADER_ONLY |
0 | Set to 1 for header-only mode |
THOR_LOGGING_DEFAULT_LOG_LEVEL |
3 |
Header-only compile-time verbosity ceiling |
LOGURU_WITH_STREAMS |
1 |
Enables loguru’s stream-based API. Always set. |
configure.ac defines the project and checks for libdl.AX_THOR_FEATURE_HEADER_ONLY_VARIANT(THORS_LOGGING) provides --enable-header-only.ThorsLoggingConfig.h is generated from config.h.in.Makefile adds -DLOGURU_WITH_STREAMS=1 to CXXFLAGS.