12#if defined(MOMENTUM_WITH_XR_LOGGER)
13#include <logging/BrokerExtension.h>
20#if !defined(MOMENTUM_WITH_XR_LOGGER)
28#if defined(MOMENTUM_WITH_XR_LOGGER)
30arvr::logging::LogResult callback(
37 arvr::logging::CustomUserData userData) {
38 const auto* rec = std::bit_cast<const rerun::RecordingStream*>(userData);
40 rerun::TextLogLevel level;
42 case static_cast<int>(arvr::logging::Level::Error):
43 level = rerun::TextLogLevel::
Error;
45 case static_cast<int>(arvr::logging::Level::Warning):
46 level = rerun::TextLogLevel::
Warning;
48 case static_cast<int>(arvr::logging::Level::Info):
49 level = rerun::TextLogLevel::
Info;
51 case static_cast<int>(arvr::logging::Level::Debug):
52 level = rerun::TextLogLevel::
Debug;
54 case static_cast<int>(arvr::logging::Level::Trace):
55 level = rerun::TextLogLevel::
Trace;
58 return arvr::logging::LogResult::Filtered;
63 rec->log(
"momentum", rerun::TextLog(message).with_level(level));
65 return arvr::logging::LogResult::Accepted;
73#if defined(MOMENTUM_WITH_XR_LOGGER)
74 static arvr::logging::LogSinkHandle handle = 0;
81 handle = arvr::logging::addSink(
82 callback,
reinterpret_cast<arvr::logging::CustomUserData
>(&rec),
"Rerun logger");
86 MT_LOGW(
"Log redirection is not supported.\n");
bool redirectLogsToRerun(const rerun::RecordingStream &rec)
Redirects logs from the XR_LOG framework to the Rerun logger.