10#ifndef logger_types_software_log_hpp
11#define logger_types_software_log_hpp
13#include <source_location>
43 const int32_t errnoCode,
45 const int32_t otherCode,
46 const char *explanation
49 auto _file =
builder.CreateString( file );
50 auto _expl =
builder.CreateString( explanation );
61 const int32_t errnoCode,
63 const int32_t otherCode,
64 const std::string &explanation
67 auto _file =
builder.CreateString( file );
68 auto _expl =
builder.CreateString( explanation );
77 const int32_t errnoCode
81 auto _file =
builder.CreateString( file );
90 const int32_t errnoCode,
92 const char *explanation
95 auto _file =
builder.CreateString( file );
96 auto _expl =
builder.CreateString( explanation );
105 const int32_t errnoCode,
107 const std::string &explanation
110 auto _file =
builder.CreateString( file );
111 auto _expl =
builder.CreateString( explanation );
120 const std::string &explanation
123 auto _file =
builder.CreateString( file );
124 auto _expl =
builder.CreateString( explanation );
135 auto _file =
builder.CreateString( file );
145 const int32_t otherCode,
146 const char *explanation,
147 const std::source_location &loc
148 = std::source_location::current()
151 auto _file =
builder.CreateString( loc.file_name() );
152 auto _expl =
builder.CreateString( explanation );
161 const std::source_location &loc
162 = std::source_location::current() )
164 auto _file =
builder.CreateString( loc.file_name() );
173 const char *explanation,
174 const std::source_location &loc
175 = std::source_location::current()
178 auto _file =
builder.CreateString( loc.file_name() );
179 auto _expl =
builder.CreateString( explanation );
188 const std::string & explanation,
189 const std::source_location &loc
190 = std::source_location::current()
193 auto _file =
builder.CreateString( loc.file_name() );
194 auto _expl =
builder.CreateString( explanation );
202 const std::source_location &loc
203 = std::source_location::current() )
205 auto _file =
builder.CreateString( loc.file_name() );
206 auto _expl =
builder.CreateString( explanation );
215 = std::source_location::current() )
217 auto _file =
builder.CreateString( loc.file_name() );
229 static_cast<size_t>( len ) );
239 static_cast<void>( len );
243 std::string ret =
"SW FILE: ";
244 if( rgs->file() !=
nullptr )
246 ret += rgs->file()->c_str();
253 ret += std::format(
" LINE: {}", rgs->line() );
255 if( rgs->errnoCode() )
257 ret += std::format(
" ERRNO: {} [{}]", rgs->errnoCode(), rgs->errnoCode() );
259 if( rgs->otherCode() )
261 ret += std::format(
" CODE: {}", rgs->otherCode() );
262 if( rgs->explanation() )
264 ret += std::format(
" [{}]", rgs->explanation()->c_str() );
267 else if( rgs->explanation() )
270 ret += rgs->explanation()->c_str();
281 static_cast<void>( member );
283 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 std::string &explanation, const std::source_location &loc=std::source_location::current())
C'tor with no codes, just the explanation.
messageT(const char *file, const uint32_t line)
C'tor for a trace log, only the file and line.
messageT(const std::source_location &loc=std::source_location::current())
C'tor for a trace log, only the file and line.
messageT(const int32_t errnoCode, const int32_t otherCode, const char *explanation, const std::source_location &loc=std::source_location::current())
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 int32_t errnoCode, const char *explanation, const std::source_location &loc=std::source_location::current())
C'tor for errno with additional explanation.
messageT(const int32_t errnoCode, const std::source_location &loc=std::source_location::current())
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 char *explanation)
C'tor for errno with additional explanation.
messageT(const int32_t errnoCode, const std::string &explanation, const std::source_location &loc=std::source_location::current())
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.