API
Collaboration diagram for The flatlogs binary header definition:

Modules

 The log priorities
 
 The flatlogs timestamp
 

Classes

class  flatlogs::logHeader
 The log entry header. More...
 

Typedefs

typedef std::shared_ptr< char > flatlogs::bufferPtrT
 The log entry buffer smart pointer. More...
 

Functions

static int flatlogs::logHeader::logLevel (bufferPtrT &logBuffer, const logPrioT &lvl)
 Set the level of a log entry in a logBuffer header. More...
 
static logPrioT flatlogs::logHeader::logLevel (bufferPtrT &logBuffer)
 Extract the level of a log entry. More...
 
static logPrioT flatlogs::logHeader::logLevel (char *logBuffer)
 Extract the level of a log entry. More...
 
static int flatlogs::logHeader::eventCode (bufferPtrT &logBuffer, const eventCodeT &ec)
 Set the event code of a log entry. More...
 
static eventCodeT flatlogs::logHeader::eventCode (bufferPtrT &logBuffer)
 Extract the event code of a log entry. More...
 
static eventCodeT flatlogs::logHeader::eventCode (char *logBuffer)
 Extract the event code of a log entry. More...
 
static int flatlogs::logHeader::timespec (bufferPtrT &logBuffer, const timespecX &ts)
 Set the timespec of a log entry. More...
 
static timespecX flatlogs::logHeader::timespec (bufferPtrT &logBuffer)
 Extract the timespec of a log entry. More...
 
static timespecX flatlogs::logHeader::timespec (char *logBuffer)
 Extract the timespec of a log entry. More...
 
static size_t flatlogs::logHeader::lenSize (bufferPtrT &logBuffer)
 Get the size in bytes of the length field for an existing logBuffer. More...
 
static size_t flatlogs::logHeader::lenSize (char *logBuffer)
 Get the size in bytes of the length field for an existing logBuffer. More...
 
static size_t flatlogs::logHeader::lenSize (msgLenT &msgSz)
 Get the size in bytes of the length field for a logBuffer given the intended message length. More...
 
static int flatlogs::logHeader::msgLen (bufferPtrT &logBuffer, const msgLenT &msgLen)
 Set the message length of a log entry message. More...
 
static msgLen0T flatlogs::logHeader::msgLen0 (bufferPtrT &logBuffer)
 Extract the short message length of a log entry message. More...
 
static msgLen0T flatlogs::logHeader::msgLen0 (char *logBuffer)
 Extract the short message length of a log entry message. More...
 
static msgLen1T flatlogs::logHeader::msgLen1 (bufferPtrT &logBuffer)
 Extract the medium message length of a log entry message. More...
 
static msgLen1T flatlogs::logHeader::msgLen1 (char *logBuffer)
 Extract the medium message length of a log entry message. More...
 
static msgLenT flatlogs::logHeader::msgLen (bufferPtrT &logBuffer)
 Extract the message length of a log entry message. More...
 
static msgLenT flatlogs::logHeader::msgLen (char *logBuffer)
 Extract the message length of a log entry message. More...
 
static size_t flatlogs::logHeader::headerSize (bufferPtrT &logBuffer)
 Get the size of the header, including the variable size length field, for an existing logBuffer. More...
 
static size_t flatlogs::logHeader::headerSize (char *logBuffer)
 Get the size of the header, including the variable size length field, for an existing logBuffer. More...
 
static size_t flatlogs::logHeader::headerSize (msgLenT &msgSz)
 Get the size of the header, including the variable size length field, given a message size. More...
 
static size_t flatlogs::logHeader::totalSize (bufferPtrT &logBuffer)
 Get the total size of the log entry, including the message buffer. More...
 
static size_t flatlogs::logHeader::totalSize (char *logBuffer)
 Get the total size of the log entry, including the message buffer. More...
 
static size_t flatlogs::logHeader::totalSize (msgLenT &msgSz)
 Get the total size of a log entry, given the message buffer size. More...
 
static void * flatlogs::logHeader::messageBuffer (bufferPtrT &logBuffer)
 Get the message buffer address. More...
 
static void * flatlogs::logHeader::messageBuffer (char *logBuffer)
 Get the message buffer address. More...
 
static int flatlogs::logHeader::extractBasicLog (logPrioT &lvl, eventCodeT &ec, timespecX &ts, msgLenT &len, bufferPtrT &logBuffer)
 Extract the basic details of a log entry. More...
 
static int flatlogs::logHeader::extractBasicLog (logPrioT &lvl, eventCodeT &ec, timespecX &ts, msgLenT &len, char *logBuffer)
 Extract the basic details of a log entry. More...
 

Detailed Description

Typedef Documentation

◆ bufferPtrT

typedef std::shared_ptr<char> flatlogs::bufferPtrT

The log entry buffer smart pointer.

Definition at line 58 of file logHeader.hpp.

Function Documentation

◆ eventCode() [1/3]

eventCodeT flatlogs::logHeader::eventCode ( bufferPtrT logBuffer)
inlinestatic

Extract the event code of a log entry.

Returns
the event code
Parameters
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 422 of file logHeader.hpp.

◆ eventCode() [2/3]

int flatlogs::logHeader::eventCode ( bufferPtrT logBuffer,
const eventCodeT ec 
)
inlinestatic

Set the event code of a log entry.

Returns
0 on success
-1 on error
Parameters
[in,out]logBuffera shared_ptr<char> containing a raw log entry buffer.
[in]ecthe new event code.

Definition at line 412 of file logHeader.hpp.

Referenced by flatlogs::logHeader::createLog(), flatlogs::logHeader::eventCode(), flatlogs::logHeader::extractBasicLog(), MagAOX::logger::logMap::getNextLog(), and MagAOX::logger::logMap::getPriorLog().

◆ eventCode() [3/3]

eventCodeT flatlogs::logHeader::eventCode ( char *  logBuffer)
inlinestatic

Extract the event code of a log entry.

Returns
the event code
Parameters
[in]logBuffera pointer a raw log entry buffer.

Definition at line 429 of file logHeader.hpp.

◆ extractBasicLog() [1/2]

int flatlogs::logHeader::extractBasicLog ( logPrioT lvl,
eventCodeT ec,
timespecX ts,
msgLenT len,
bufferPtrT logBuffer 
)
inlinestatic

Extract the basic details of a log entry.

Convenience wrapper for the other extraction functions.

Returns
0 on success, -1 on error.
Parameters
[out]lvlThe log level
[out]ecthe event code
[out]tsthe timestamp of the log entry
[out]lenthe message length
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 667 of file logHeader.hpp.

Referenced by flatlogs::jsonFormat(), flatlogs::minFormat(), flatlogs::stdFormat(), and flatlogs::stdShortFormat().

◆ extractBasicLog() [2/2]

int flatlogs::logHeader::extractBasicLog ( logPrioT lvl,
eventCodeT ec,
timespecX ts,
msgLenT len,
char *  logBuffer 
)
inlinestatic

Extract the basic details of a log entry.

Convenience wrapper for the other extraction functions.

Returns
0 on success, -1 on error.
Parameters
[out]lvlThe log level
[out]ecthe event code
[out]tsthe timestamp of the log entry
[out]lenthe message length
[in]logBuffera pointer to a raw log entry buffer.

Definition at line 687 of file logHeader.hpp.

◆ headerSize() [1/3]

size_t flatlogs::logHeader::headerSize ( bufferPtrT logBuffer)
inlinestatic

Get the size of the header, including the variable size length field, for an existing logBuffer.

Returns
the size of the header in this log entry.
Parameters
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 499 of file logHeader.hpp.

Referenced by flatlogs::logHeader::messageBuffer(), and flatlogs::logHeader::totalSize().

◆ headerSize() [2/3]

size_t flatlogs::logHeader::headerSize ( char *  logBuffer)
inlinestatic

Get the size of the header, including the variable size length field, for an existing logBuffer.

Returns
the size of the header in this log entry.
Parameters
[in]logBuffera pointer to a raw log entry buffer.

Definition at line 506 of file logHeader.hpp.

◆ headerSize() [3/3]

size_t flatlogs::logHeader::headerSize ( msgLenT msgSz)
inlinestatic

Get the size of the header, including the variable size length field, given a message size.

Returns
the size to be used for the header.
Parameters
[in]msgSzthe size of the intended message.

Definition at line 512 of file logHeader.hpp.

◆ lenSize() [1/3]

size_t flatlogs::logHeader::lenSize ( bufferPtrT logBuffer)
inlinestatic

Get the size in bytes of the length field for an existing logBuffer.

Returns
the number of bytes in the length field.
Parameters
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 458 of file logHeader.hpp.

Referenced by flatlogs::logHeader::headerSize().

◆ lenSize() [2/3]

size_t flatlogs::logHeader::lenSize ( char *  logBuffer)
inlinestatic

Get the size in bytes of the length field for an existing logBuffer.

Returns
the number of bytes in the length field.
Parameters
[in]logBuffera pointer to a raw log entry buffer.

Definition at line 474 of file logHeader.hpp.

◆ lenSize() [3/3]

size_t flatlogs::logHeader::lenSize ( msgLenT msgSz)
inlinestatic

Get the size in bytes of the length field for a logBuffer given the intended message length.

Returns
the number of bytes to be put in the length field.
Parameters
[in]msgSzthe size of the intended message.

Definition at line 489 of file logHeader.hpp.

◆ logLevel() [1/3]

logPrioT flatlogs::logHeader::logLevel ( bufferPtrT logBuffer)
inlinestatic

Extract the level of a log entry.

Returns
the level
Parameters
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 398 of file logHeader.hpp.

◆ logLevel() [2/3]

int flatlogs::logHeader::logLevel ( bufferPtrT logBuffer,
const logPrioT lvl 
)
inlinestatic

Set the level of a log entry in a logBuffer header.

Returns
0 on success
-1 on error
Parameters
logBuffer[in/out] a shared_ptr<char> containing a raw log entry buffer.
[in]lvlthe new log level.

Definition at line 388 of file logHeader.hpp.

Referenced by flatlogs::logHeader::createLog(), flatlogs::logHeader::extractBasicLog(), flatlogs::logHeader::logLevel(), and MagAOX::logger::logManager< _parentT, _logFileT >::logThreadExec().

◆ logLevel() [3/3]

logPrioT flatlogs::logHeader::logLevel ( char *  logBuffer)
inlinestatic

Extract the level of a log entry.

Returns
the level
Parameters
[in]logBuffera pointer to a raw log entry buffer.

Definition at line 406 of file logHeader.hpp.

◆ messageBuffer() [1/2]

void * flatlogs::logHeader::messageBuffer ( bufferPtrT logBuffer)
inlinestatic

Get the message buffer address.

Returns
the address of the message buffer.
Parameters
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 621 of file logHeader.hpp.

Referenced by flatlogs::logHeader::createLog(), MagAOX::logger::telem_cooler::getDouble(), MagAOX::logger::getLogContVal(), MagAOX::logger::getLogStateVal(), flatlogs::jsonFormat(), flatlogs::minFormat(), flatlogs::stdFormat(), flatlogs::stdShortFormat(), MagAOX::logger::config_log::verify(), MagAOX::logger::git_state::verify(), MagAOX::logger::observer::verify(), MagAOX::logger::ocam_temps::verify(), MagAOX::logger::outlet_channel_state::verify(), MagAOX::logger::outlet_state::verify(), MagAOX::logger::pico_channel::verify(), MagAOX::logger::saving_state_change::verify(), MagAOX::logger::software_log::verify(), MagAOX::logger::state_change::verify(), MagAOX::logger::string_log::verify(), MagAOX::logger::telem_blockgains::verify(), MagAOX::logger::telem_chrony_stats::verify(), MagAOX::logger::telem_chrony_status::verify(), MagAOX::logger::telem_cooler::verify(), MagAOX::logger::telem_coreloads::verify(), MagAOX::logger::telem_coretemps::verify(), MagAOX::logger::telem_dmmodes::verify(), MagAOX::logger::telem_dmspeck::verify(), MagAOX::logger::telem_drivetemps::verify(), MagAOX::logger::telem_fgtimings::verify(), MagAOX::logger::telem_fxngen::verify(), MagAOX::logger::telem_loopgain::verify(), MagAOX::logger::telem_observer::verify(), MagAOX::logger::telem_pico::verify(), MagAOX::logger::telem_pokecenter::verify(), MagAOX::logger::telem_position::verify(), MagAOX::logger::telem_rhusb::verify(), MagAOX::logger::telem_saving::verify(), MagAOX::logger::telem_stage::verify(), MagAOX::logger::telem_stdcam::verify(), MagAOX::logger::telem_telcat::verify(), MagAOX::logger::telem_teldata::verify(), MagAOX::logger::telem_telenv::verify(), MagAOX::logger::telem_telpos::verify(), MagAOX::logger::telem_telsee::verify(), MagAOX::logger::telem_telvane::verify(), MagAOX::logger::telem_temps::verify(), MagAOX::logger::telem_usage::verify(), MagAOX::logger::telem_zaber::verify(), and MagAOX::logger::ttmmod_params::verify().

◆ messageBuffer() [2/2]

void * flatlogs::logHeader::messageBuffer ( char *  logBuffer)
inlinestatic

Get the message buffer address.

Returns
the address of the message buffer.
Parameters
[in]logBuffera pointer to a raw log entry buffer.

Definition at line 628 of file logHeader.hpp.

◆ msgLen() [1/3]

msgLenT flatlogs::logHeader::msgLen ( bufferPtrT logBuffer)
inlinestatic

Extract the message length of a log entry message.

Returns
the message length
Parameters
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 569 of file logHeader.hpp.

◆ msgLen() [2/3]

int flatlogs::logHeader::msgLen ( bufferPtrT logBuffer,
const msgLenT msgLen 
)
inlinestatic

Set the message length of a log entry message.

Note
The logBuffer must already be allocated with a header large enough for this message size.
Returns
0 on success
-1 on error
Parameters
[out]logBuffera shared_ptr<char> containing a raw log entry buffer allocated with large enough header for this message length.
[in]msgLenthe message length to set.

Definition at line 518 of file logHeader.hpp.

Referenced by flatlogs::logHeader::createLog(), flatlogs::logHeader::extractBasicLog(), flatlogs::logHeader::msgLen(), and flatlogs::logHeader::totalSize().

◆ msgLen() [3/3]

msgLenT flatlogs::logHeader::msgLen ( char *  logBuffer)
inlinestatic

Extract the message length of a log entry message.

Returns
the message length
Parameters
[in]logBuffera pointer to a raw log entry buffer.

Definition at line 585 of file logHeader.hpp.

◆ msgLen0() [1/2]

msgLen0T flatlogs::logHeader::msgLen0 ( bufferPtrT logBuffer)
inlinestatic

Extract the short message length of a log entry message.

This is always safe on a minimally allocated logBuffer, can be used to test for progressive reading.

Returns
the short message length field
Parameters
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 543 of file logHeader.hpp.

Referenced by flatlogs::logHeader::lenSize(), flatlogs::logHeader::msgLen(), and flatlogs::logHeader::msgLen0().

◆ msgLen0() [2/2]

msgLen0T flatlogs::logHeader::msgLen0 ( char *  logBuffer)
inlinestatic

Extract the short message length of a log entry message.

This is always safe on a minimally allocated logBuffer, can be used to test for progressive reading.

Returns
the short message length field
Parameters
[in]logBuffera pointer to a raw log entry buffer.

Definition at line 550 of file logHeader.hpp.

◆ msgLen1() [1/2]

msgLen1T flatlogs::logHeader::msgLen1 ( bufferPtrT logBuffer)
inlinestatic

Extract the medium message length of a log entry message.

This is NOT always safe, and should only be caled if msgLen0 is 0xFE. Can be used to test for progressive reading.

Returns
the medium message length field
Parameters
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 556 of file logHeader.hpp.

Referenced by flatlogs::logHeader::msgLen(), and flatlogs::logHeader::msgLen1().

◆ msgLen1() [2/2]

msgLen1T flatlogs::logHeader::msgLen1 ( char *  logBuffer)
inlinestatic

Extract the medium message length of a log entry message.

This is NOT always safe, and should only be caled if msgLen0 is 0xFE. Can be used to test for progressive reading.

Returns
the medium message length field
Parameters
[in]logBuffera pointer to a raw log entry buffer.

Definition at line 563 of file logHeader.hpp.

◆ timespec() [1/3]

timespecX flatlogs::logHeader::timespec ( bufferPtrT logBuffer)
inlinestatic

Extract the timespec of a log entry.

Returns
the timespec
Parameters
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 445 of file logHeader.hpp.

◆ timespec() [2/3]

int flatlogs::logHeader::timespec ( bufferPtrT logBuffer,
const timespecX ts 
)
inlinestatic

Set the timespec of a log entry.

Returns
0 on success
-1 on error
Parameters
[in,out]logBuffera shared_ptr<char> containing a raw log entry buffer.*‍/
[in]tsthe new timespec

Definition at line 435 of file logHeader.hpp.

Referenced by flatlogs::logHeader::createLog(), flatlogs::logHeader::extractBasicLog(), MagAOX::logger::getLogContVal(), MagAOX::logger::getLogStateVal(), MagAOX::logger::logMap::getPriorLog(), MagAOX::logger::logInMemory::loadFile(), flatlogs::logHeader::timespec(), and MagAOX::logger::logFileRaw::writeLog().

◆ timespec() [3/3]

timespecX flatlogs::logHeader::timespec ( char *  logBuffer)
inlinestatic

Extract the timespec of a log entry.

Returns
the timespec
Parameters
[in]logBuffera pointer to a raw log entry buffer.

Definition at line 452 of file logHeader.hpp.

◆ totalSize() [1/3]

size_t flatlogs::logHeader::totalSize ( bufferPtrT logBuffer)
inlinestatic

Get the total size of the log entry, including the message buffer.

Returns
the total size of this log entry.
Parameters
[in]logBuffera shared_ptr<char> containing a raw log entry buffer.

Definition at line 602 of file logHeader.hpp.

Referenced by flatlogs::logHeader::createLog(), MagAOX::logger::logMap::getNextLog(), MagAOX::logger::logMap::getPriorLog(), MagAOX::logger::logInMemory::loadFile(), and MagAOX::logger::logFileRaw::writeLog().

◆ totalSize() [2/3]

size_t flatlogs::logHeader::totalSize ( char *  logBuffer)
inlinestatic

Get the total size of the log entry, including the message buffer.

Returns
the total size of this log entry.
Parameters
[in]logBuffera pointer to a raw log entry buffer.

Definition at line 609 of file logHeader.hpp.

◆ totalSize() [3/3]

size_t flatlogs::logHeader::totalSize ( msgLenT msgSz)
inlinestatic

Get the total size of a log entry, given the message buffer size.

Returns
the total size to be used for a log entry.
Parameters
[in]msgSzthe intended size of the message buffer.

Definition at line 615 of file logHeader.hpp.