HardFOC Core
API reference
Loading...
Searching...
No Matches
NoBackendLoggerFactory.cpp File Reference

Logger::CreateDefaultBaseLogger() for builds with no MCU (HF_CORE_MCU=NONE). More...

#include "../Logger.h"
#include "base/BaseLogger.h"
#include <memory>

Detailed Description

Logger::CreateDefaultBaseLogger() for builds with no MCU (HF_CORE_MCU=NONE).

A host build has no default log transport, so the factory returns nullptr and Logger::Initialize(config) returns false. Host code that wants log output injects a backend with the two-argument overload:

Logger::GetInstance().Initialize(LogConfig{}, std::make_unique<MyHostLogger>());
static Logger & GetInstance() noexcept
Get singleton instance.
Definition Logger.cpp:91
bool Initialize(const LogConfig &config=LogConfig{}) noexcept
Initialize the logger using the platform-default BaseLogger backend (resolved via the MCU-specific lo...
Definition Logger.cpp:100
Logging configuration.
Definition Logger.h:96

Logging calls made before a backend is injected are dropped, as on target. The host build (top-level CMakeLists.txt) links this file; on-target builds link their MCU factory instead (EspLoggerFactory.cpp).