10 #ifndef logger_types_telem_observer_hpp
11 #define logger_types_telem_observer_hpp
13 #include "generated/telem_observer_generated.h"
62 bool ok = VerifyTelem_observer_fbBuffer(verifier);
69 std::string
email = fbs->email()->c_str();
70 for(
size_t n = 0; n <
email.size(); ++n)
72 if(!isprint(
email[n]))
81 std::string obsn = fbs->obsName()->c_str();
82 for(
size_t n = 0; n < obsn.size(); ++n)
99 static_cast<void>(len);
101 auto fbs = GetTelem_observer_fb(msgBuffer);
103 std::string
msg =
"[observer] ";
108 msg += fbs->email()->c_str();
115 msg += fbs->obsName()->c_str();
119 msg += std::to_string(fbs->observing());
125 static std::string
email(
void * msgBuffer )
127 auto fbs = GetTelem_observer_fb(msgBuffer);
128 if(fbs->email() !=
nullptr)
130 return std::string(fbs->email()->c_str());
135 static std::string
obsName(
void * msgBuffer )
137 auto fbs = GetTelem_observer_fb(msgBuffer);
138 if(fbs->email() !=
nullptr)
140 return std::string(fbs->obsName()->c_str());
147 auto fbs = GetTelem_observer_fb(msgBuffer);
148 return fbs->observing();
158 if( member ==
"email")
return logMetaDetail({
"OBSERVER", logMeta::valTypes::String, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
email),
false});
159 else if(member ==
"obsName")
return logMetaDetail({
"OBS-NAME", logMeta::valTypes::String, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
obsName),
false});
160 else if(member ==
"observing")
return logMetaDetail({
"OBSERVING", logMeta::valTypes::Bool, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
observing)});
163 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.
constexpr static 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)
Construct from components.
Log entry recording the build-time git state.
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 formattd for human consumption.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)