10#ifndef logger_types_software_log_hpp
11#define logger_types_software_log_hpp
40 const int32_t errnoCode,
41 const int32_t otherCode,
42 const char * explanation
45 auto _file =
builder.CreateString(file);
46 auto _expl =
builder.CreateString(explanation);
57 const int32_t errnoCode,
58 const int32_t otherCode,
59 const std::string & explanation
62 auto _file =
builder.CreateString(file);
63 auto _expl =
builder.CreateString(explanation);
72 const int32_t errnoCode
75 auto _file =
builder.CreateString(file);
84 const int32_t errnoCode,
85 const char * explanation
88 auto _file =
builder.CreateString(file);
89 auto _expl =
builder.CreateString(explanation);
98 const int32_t errnoCode,
99 const std::string & explanation
102 auto _file =
builder.CreateString(file);
103 auto _expl =
builder.CreateString(explanation);
112 const std::string & explanation
115 auto _file =
builder.CreateString(file);
116 auto _expl =
builder.CreateString(explanation);
127 auto _file =
builder.CreateString(file);
150 static_cast<void>(len);
154 std::string ret =
"SW FILE: ";
155 if(rgs->file() !=
nullptr)
157 ret += rgs->file()->c_str();
164 ret += std::format(
" LINE: {}",rgs->line());
168 ret += std::format(
" ERRNO: {} [{}]",rgs->errnoCode(),rgs->errnoCode());
172 ret += std::format(
" CODE: {}",rgs->otherCode());
173 if(rgs->explanation())
175 ret += std::format(
" [{}]",rgs->explanation()->c_str());
178 else if(rgs->explanation())
181 ret += rgs->explanation()->c_str();
192 static_cast<void>(member);
194 std::cerr <<
"meta data doesn't make sense for software_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.
static constexpr flatlogs::eventCodeT SOFTWARE_LOG
inline ::flatbuffers::Offset< Software_log_fb > CreateSoftware_log_fb(::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::Offset<::flatbuffers::String > file=0, uint32_t line=0, int32_t errnoCode=0, int32_t otherCode=0, ::flatbuffers::Offset<::flatbuffers::String > explanation=0)
const MagAOX::logger::Software_log_fb * GetSoftware_log_fb(const void *buf)
bool VerifySoftware_log_fbBuffer(::flatbuffers::Verifier &verifier)
static constexpr logPrioT LOG_NOTICE
A normal but significant condition.
static constexpr logPrioT LOG_INFO
Informational. The info log level is the lowest level recorded during normal operations.
static constexpr logPrioT LOG_CRITICAL
The process can not continue and will shut down (fatal)
static constexpr logPrioT LOG_WARNING
A condition has occurred which may become an error, but the process continues.
static constexpr logPrioT LOG_ERROR
An error has occured which the software will attempt to correct.
static constexpr logPrioT LOG_EMERGENCY
Normal operations of the entire system should be shut down immediately.
static constexpr logPrioT LOG_DEBUG
Used for debugging.
static constexpr logPrioT LOG_DEBUG2
Used for debugging, providing a 2nd level.
static constexpr logPrioT LOG_ALERT
This should only be used if some action is required by operators to keep the system safe.
Message type for resolving log messages with a f.b. builder.
flatbuffers::FlatBufferBuilder builder
Base class for logs consisting of a flatbuffer message.
Software ALERT log entry.
static const flatlogs::logPrioT defaultLevel
The default level.
Software CRITICAL log entry.
static const flatlogs::logPrioT defaultLevel
The default level.
Software DEBUG2 log entry.
static const flatlogs::logPrioT defaultLevel
The default level.
Software DEBUG log entry.
static const flatlogs::logPrioT defaultLevel
The default level.
Software EMERGENCY log entry.
static const flatlogs::logPrioT defaultLevel
The default level.
static const flatlogs::logPrioT defaultLevel
The default level.
static const flatlogs::logPrioT defaultLevel
The default level.
messageT(const char *file, const uint32_t line, const int32_t errnoCode, const int32_t otherCode, const std::string &explanation)
C'tor with full specification, overloaded for a std::string in explanation.
messageT(const char *file, const uint32_t line, const std::string &explanation)
C'tor with no codes, just the explanation.
messageT(const char *file, const uint32_t line, const int32_t errnoCode)
C'tor for errno only – code explanation can be looked up later.
messageT(const char *file, const uint32_t line, const int32_t errnoCode, const std::string &explanation)
C'tor for errno with additional explanation, std::string overload.
messageT(const char *file, const uint32_t line)
C'tor for a trace log, only the file and line.
messageT(const char *file, const uint32_t line, const int32_t errnoCode, const int32_t otherCode, const char *explanation)
C'tor with full specification.
messageT(const char *file, const uint32_t line, const int32_t errnoCode, const char *explanation)
C'tor for errno with additional explanation.
Base class for software logs.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static const flatlogs::eventCodeT eventCode
The event code.
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatted for human consumption.
static logMetaDetail getAccessor(const std::string &member)
Get an empty logMetaDetail because meta data doesn't make sense for this log.
Software NOTICE log entry.
static const flatlogs::logPrioT defaultLevel
The default level.
static const flatlogs::logPrioT defaultLevel
The default level.