11 #ifndef logger_types_user_log_hpp
12 #define logger_types_user_log_hpp
14 #include "generated/user_log_generated.h"
43 auto gs = CreateUser_log_fb(
builder, _eml, _msg);
53 return VerifyString_log_fbBuffer(verifier);
61 static_cast<void>(len);
63 auto fbs = GetUser_log_fb(msgBuffer);
65 std::string
msg =
"[USER] ";
69 msg += fbs->email()->c_str();
79 msg += fbs->message()->c_str();
86 static std::string
email(
void * msgBuffer )
88 auto fbs = GetUser_log_fb(msgBuffer);
89 if(fbs->email() !=
nullptr)
91 return std::string(fbs->email()->c_str());
97 static std::string
message(
void * msgBuffer )
99 auto fbs = GetUser_log_fb(msgBuffer);
100 if(fbs->message() !=
nullptr)
102 return std::string(fbs->message()->c_str());
114 if( member ==
"email")
return logMetaDetail({
"USER", logMeta::valTypes::String, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
email),
false});
115 else if(member ==
"message")
return logMetaDetail({
"MESSAGE", logMeta::valTypes::String, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
message),
false});
118 std::cerr <<
"No string member " << member <<
" in user_log\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_INFO
Informational. The info log level is the lowest level recorded during normal operations.
Message type for resolving log messages with a f.b. builder.
flatbuffers::FlatBufferBuilder builder
Base class for logs consisting of a flatbuffer message.
messageT(const std::string &email, const std::string &message)
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatte for human consumption.
static const flatlogs::eventCodeT eventCode
The event code.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static const flatlogs::logPrioT defaultLevel
The default level.
static std::string email(void *msgBuffer)
Get the user email from a user_log.
static std::string message(void *msgBuffer)
Get the message from a user_log.
static logMetaDetail getAccessor(const std::string &member)
Get the logMetaDetail for a member by name.