The log entry header. More...
#include <logHeader.hpp>
Classes | |
struct | internal_logHeader |
union | internal_logHeader.__unnamed4__ |
Static Public Member Functions | |
static int | logLevel (bufferPtrT &logBuffer, const logPrioT &lvl) |
Set the level of a log entry in a logBuffer header. More... | |
static logPrioT | logLevel (bufferPtrT &logBuffer) |
Extract the level of a log entry. More... | |
static logPrioT | logLevel (char *logBuffer) |
Extract the level of a log entry. More... | |
static int | eventCode (bufferPtrT &logBuffer, const eventCodeT &ec) |
Set the event code of a log entry. More... | |
static eventCodeT | eventCode (bufferPtrT &logBuffer) |
Extract the event code of a log entry. More... | |
static eventCodeT | eventCode (char *logBuffer) |
Extract the event code of a log entry. More... | |
static int | timespec (bufferPtrT &logBuffer, const timespecX &ts) |
Set the timespec of a log entry. More... | |
static timespecX | timespec (bufferPtrT &logBuffer) |
Extract the timespec of a log entry. More... | |
static timespecX | timespec (char *logBuffer) |
Extract the timespec of a log entry. More... | |
static size_t | lenSize (bufferPtrT &logBuffer) |
Get the size in bytes of the length field for an existing logBuffer. More... | |
static size_t | lenSize (char *logBuffer) |
Get the size in bytes of the length field for an existing logBuffer. More... | |
static size_t | lenSize (msgLenT &msgSz) |
Get the size in bytes of the length field for a logBuffer given the intended message length. More... | |
static int | msgLen (bufferPtrT &logBuffer, const msgLenT &msgLen) |
Set the message length of a log entry message. More... | |
static msgLen0T | msgLen0 (bufferPtrT &logBuffer) |
Extract the short message length of a log entry message. More... | |
static msgLen0T | msgLen0 (char *logBuffer) |
Extract the short message length of a log entry message. More... | |
static msgLen1T | msgLen1 (bufferPtrT &logBuffer) |
Extract the medium message length of a log entry message. More... | |
static msgLen1T | msgLen1 (char *logBuffer) |
Extract the medium message length of a log entry message. More... | |
static msgLenT | msgLen (bufferPtrT &logBuffer) |
Extract the message length of a log entry message. More... | |
static msgLenT | msgLen (char *logBuffer) |
Extract the message length of a log entry message. More... | |
static size_t | headerSize (bufferPtrT &logBuffer) |
Get the size of the header, including the variable size length field, for an existing logBuffer. More... | |
static size_t | headerSize (char *logBuffer) |
Get the size of the header, including the variable size length field, for an existing logBuffer. More... | |
static size_t | headerSize (msgLenT &msgSz) |
Get the size of the header, including the variable size length field, given a message size. More... | |
static size_t | totalSize (bufferPtrT &logBuffer) |
Get the total size of the log entry, including the message buffer. More... | |
static size_t | totalSize (char *logBuffer) |
Get the total size of the log entry, including the message buffer. More... | |
static size_t | totalSize (msgLenT &msgSz) |
Get the total size of a log entry, given the message buffer size. More... | |
static void * | messageBuffer (bufferPtrT &logBuffer) |
Get the message buffer address. More... | |
static void * | messageBuffer (char *logBuffer) |
Get the message buffer address. More... | |
template<typename logT > | |
static int | createLog (bufferPtrT &logBuffer, const timespecX &ts, const typename logT::messageT &msg, const logPrioT &level) |
Create a formatted log entry, filling in a buffer. More... | |
static int | extractBasicLog (logPrioT &lvl, eventCodeT &ec, timespecX &ts, msgLenT &len, bufferPtrT &logBuffer) |
Extract the basic details of a log entry. More... | |
static int | extractBasicLog (logPrioT &lvl, eventCodeT &ec, timespecX &ts, msgLenT &len, char *logBuffer) |
Extract the basic details of a log entry. More... | |
Static Public Attributes | |
constexpr static size_t | MAX_LEN0 = std::numeric_limits<msgLen0T>::max() |
The max value in the msgLen0 field. More... | |
constexpr static size_t | MAX_LEN1 = std::numeric_limits<msgLen1T>::max() |
The max value in the msgLen1 field. More... | |
constexpr static int | minHeadSize |
The minimum header size. More... | |
constexpr static int | maxHeadSize = minHeadSize + sizeof(msgLen2T) |
The maximum header size. More... | |
The log entry header.
This class is designed to work with the log header only as a shared pointer to it, not directly on the members. The actual header struct is private so we ensure that it is accessed properly. As such all of the member methods are static and take a shared_ptr as first argument.
Definition at line 70 of file logHeader.hpp.
struct flatlogs::logHeader::internal_logHeader |
Definition at line 94 of file logHeader.hpp.
Class Members | ||
---|---|---|
union internal_logHeader | __unnamed__ | |
eventCodeT | m_eventCode | |
logPrioT | m_logLevel | |
timespecX | m_timespecX | |
msgLen0T | msgLen0 | The short message length. Always present. |
union flatlogs::logHeader::internal_logHeader.__unnamed4__ |
Definition at line 100 of file logHeader.hpp.
Class Members | ||
---|---|---|
msgLen1T | msgLen1 | The intermediate message length. Only present if msgLen0 == max-1 of msgLen0T. |
msgLen2T | msgLen2 | The long message length. Only present if msgLen1 == max-value of msgLen0T. |
|
static |
Create a formatted log entry, filling in a buffer.
This version has the timestamp provided.
logT | is a log entry type |
[out] | logBuffer | a shared_ptr<logBuffer>, which will be allocated and populated with the log entry |
[in] | ts | the timestamp of this log entry. |
[in] | msg | the message to log (could be of type emptyMessage) |
[in] | level | the level (verbosity) of this log |
Definition at line 634 of file logHeader.hpp.
|
staticconstexpr |
The max value in the msgLen0 field.
Definition at line 76 of file logHeader.hpp.
|
staticconstexpr |
The max value in the msgLen1 field.
Definition at line 79 of file logHeader.hpp.
|
staticconstexpr |
The maximum header size.
The header component could be as big as this.
Definition at line 90 of file logHeader.hpp.
|
staticconstexpr |
The minimum header size.
A buffer must be allocated to at least this size.
Definition at line 84 of file logHeader.hpp.