10#ifndef logger_types_telem_observer_hpp
11#define logger_types_telem_observer_hpp
13#include "generated/telem_observer_generated.h"
52 auto fp = CreateTelem_observer_fb(
builder, _email, _obsName,
observing, _tgtName);
64 bool ok = VerifyTelem_observer_fbBuffer(verifier);
71 std::string
email = fbs->email()->c_str();
72 for(
size_t n = 0; n <
email.size(); ++n)
74 if(!isprint(
email[n]))
83 std::string obsn = fbs->obsName()->c_str();
84 for(
size_t n = 0; n < obsn.size(); ++n)
95 std::string tgtn = fbs->tgt_name()->c_str();
96 for(
size_t n = 0; n < tgtn.size(); ++n)
113 static_cast<void>(len);
115 auto fbs = GetTelem_observer_fb(msgBuffer);
117 std::string msg =
"[observer] ";
122 msg += fbs->email()->c_str();
129 msg += fbs->obsName()->c_str();
133 msg += std::to_string(fbs->observing());
138 msg += fbs->tgt_name()->c_str();
143 msg +=
" tgt: notimpl";
150 static std::string
email(
void * msgBuffer )
152 auto fbs = GetTelem_observer_fb(msgBuffer);
153 if(fbs->email() !=
nullptr)
155 return std::string(fbs->email()->c_str());
160 static std::string
obsName(
void * msgBuffer )
162 auto fbs = GetTelem_observer_fb(msgBuffer);
163 if(fbs->email() !=
nullptr)
165 return std::string(fbs->obsName()->c_str());
172 auto fbs = GetTelem_observer_fb(msgBuffer);
173 return fbs->observing();
176 static std::string
tgtName(
void * msgBuffer )
178 auto fbs = GetTelem_observer_fb(msgBuffer);
179 if(fbs->tgt_name() !=
nullptr)
181 return std::string(fbs->tgt_name()->c_str());
183 else return "notimpl";
199 std::cerr <<
"No string member " << member <<
" in telem_observer\n";
The MagAO-X logger flatbuffer log base type.
uint16_t eventCodeT
The type of an event code (16-bit unsigned int).
msgLen2T msgLenT
The type used to refer to the message length, regardless of length.
int8_t logPrioT
The type of the log priority code.
static void * messageBuffer(bufferPtrT &logBuffer)
Get the message buffer address.
std::shared_ptr< char > bufferPtrT
The log entry buffer smart pointer.
static constexpr logPrioT LOG_TELEM
A telemetry recording.
Message type for resolving log messages with a f.b. builder.
flatbuffers::FlatBufferBuilder builder
Base class for logs consisting of a flatbuffer message.
The type of the input message.
messageT(const std::string &email, const std::string &obsName, const bool &observing, const std::string &tgtName)
Construct from components.
Log entry recording the build-time git state.
static std::string tgtName(void *msgBuffer)
static std::string obsName(void *msgBuffer)
static timespec lastRecord
The time of the last time this log was recorded. Used by the telemetry system.
static logMetaDetail getAccessor(const std::string &member)
Get the logMetaDetail for a member by name.
static std::string email(void *msgBuffer)
static const flatlogs::logPrioT defaultLevel
The default level.
static bool observing(void *msgBuffer)
static const flatlogs::eventCodeT eventCode
The event code.
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatted for human consumption.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)