12 #ifndef flatlogs_logHeader_hpp
13 #define flatlogs_logHeader_hpp
76 constexpr
static size_t MAX_LEN0 = std::numeric_limits<msgLen0T>::max() ;
79 constexpr
static size_t MAX_LEN1 = std::numeric_limits<msgLen1T>::max();
105 } __attribute__((packed));
204 static size_t lenSize(
char * logBuffer );
317 static size_t totalSize(
char * logBuffer );
350 template<
typename logT>
353 const typename logT::messageT &
msg,
460 return lenSize(logBuffer.get());
545 return msgLen0(logBuffer.get());
558 return msgLen1(logBuffer.get());
571 return msgLen(logBuffer.get());
633 template<
typename logT>
636 const typename logT::messageT &
msg,
643 lvl = logT::defaultLevel;
uint16_t msgLen1T
The type used for intermediate message length.
uint16_t eventCodeT
The type of an event code (16-bit unsigned int).
uint64_t msgLen2T
The type used for long message length.
msgLen2T msgLenT
The type used to refer to the message length, regardless of length.
int8_t logPrioT
The type of the log priority code.
uint32_t secT
The type used for seconds.
uint8_t msgLen0T
The type used for the short message length.
static msgLen1T msgLen1(bufferPtrT &logBuffer)
Extract the medium message length of a log entry message.
static int eventCode(bufferPtrT &logBuffer, const eventCodeT &ec)
Set the event code of a log entry.
static msgLen0T msgLen0(bufferPtrT &logBuffer)
Extract the short message length of a log entry message.
static size_t totalSize(bufferPtrT &logBuffer)
Get the total size of the log entry, including the message buffer.
static void * messageBuffer(bufferPtrT &logBuffer)
Get the message buffer address.
std::shared_ptr< char > bufferPtrT
The log entry buffer smart pointer.
static int extractBasicLog(logPrioT &lvl, eventCodeT &ec, timespecX &ts, msgLenT &len, bufferPtrT &logBuffer)
Extract the basic details of a log entry.
static size_t headerSize(bufferPtrT &logBuffer)
Get the size of the header, including the variable size length field, for an existing logBuffer.
static int msgLen(bufferPtrT &logBuffer, const msgLenT &msgLen)
Set the message length of a log entry message.
static size_t lenSize(bufferPtrT &logBuffer)
Get the size in bytes of the length field for an existing logBuffer.
static int logLevel(bufferPtrT &logBuffer, const logPrioT &lvl)
Set the level of a log entry in a logBuffer header.
static int timespec(bufferPtrT &logBuffer, const timespecX &ts)
Set the timespec of a log entry.
Type definitions for the flatlogs format.
The MagAO-X logger log priority levels.
constexpr static logPrioT LOG_DEFAULT
Used to denote "use the default level for this log type".
uint32_t nanosecT
The type used for nanoseconds.
A fixed-width timespec structure.
A fixed-width timespec structure and utilities.