MagAO-X
Operations Applications Utilities Source
All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Modules Pages
MagAOX::logger::software_log Struct Reference

Base class for software logs. More...

#include <software_log.hpp>

Inheritance diagram for MagAOX::logger::software_log:
Inheritance graph
Collaboration diagram for MagAOX::logger::software_log:
Collaboration graph

Classes

struct  messageT
 The type of the message. More...
 

Static Public Member Functions

static std::string msgString (void *msgBuffer, flatlogs::msgLenT len)
 Get the message formatted for human consumption. More...
 
static flatlogs::msgLenT length (const fbMessage &msg)
 Get the length of the message. More...
 
static int format (void *msgBuffer, const fbMessage &msg)
 Format the buffer given the input message. More...
 

Static Public Attributes

static const flatlogs::eventCodeT eventCode = eventCodes::SOFTWARE_LOG
 The event code. More...
 

Detailed Description

Base class for software logs.

Such logs are used to log software status, warnings, and errors. Does not have defaultLevel, so this can not be used as a log type in logger.

The message parameters are:

  • file which should be the __FILE__ macro
  • line which should be the __LINE__ macro
  • code_errno which should be the errno value, or 0 if not relevant
  • code_other which should a non-errno code if relevant, 0 otherwise.
  • expl which is an explanation of the error. Can be empty.
software_log::messageT constructors are provided with combinations of the parameters. Some examples:

log<software_error>({__FILE__, __LINE__, errno, retval, "an error occurred"}); //log an error with full details.
log<software_error>({__FILE__, __LINE__, errno); //log an error with just errno. strerror can be used to get the explanation so we don't log it.
log<software_info>({__FILE__, __LINE__, "a directory was created"}); //an informational message
log<software_debug>({__FILE__, __LINE__}); //a trace

Definition at line 29 of file software_log.hpp.

Member Function Documentation

◆ format()

static int MagAOX::logger::flatbuffer_log::format ( void *  msgBuffer,
const fbMessage msg 
)
inlinestaticinherited

Format the buffer given the input message.

Todo:
this is an unneccesary memcpy from the FlatBufferBuilder, we need to figure out how to not do this.
Parameters
msgBufferthe buffer, must be pre-allocated to size length(msg)
msgthe message which contains a flatbuffer builder, from which the data are memcpy-ed.

Definition at line 47 of file flatbuffer_log.hpp.

◆ length()

static flatlogs::msgLenT MagAOX::logger::flatbuffer_log::length ( const fbMessage msg)
inlinestaticinherited

Get the length of the message.

Parameters
msgthe fbMessage type holding a FlatBufferBuilder

Definition at line 39 of file flatbuffer_log.hpp.

◆ msgString()

static std::string MagAOX::logger::software_log::msgString ( void *  msgBuffer,
flatlogs::msgLenT  len 
)
inlinestatic

Get the message formatted for human consumption.

Parameters
msgBufferBuffer containing the flatbuffer serialized message.
len[unused] length of msgBuffer.

Definition at line 138 of file software_log.hpp.

Member Data Documentation

◆ eventCode

const flatlogs::eventCodeT MagAOX::logger::software_log::eventCode = eventCodes::SOFTWARE_LOG
static

The event code.

Definition at line 32 of file software_log.hpp.


The documentation for this struct was generated from the following file: