|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Wire/storage layout of one log record: fixed header immediately followed by the message text. More...
#include <Utils.h>
Public Member Functions | |
| const char * | getText (uint32 &len) |
| Access the text payload stored after the header. | |
| bool | setText (char *text, uint32 len) |
Copy len bytes of text into the payload area and update size. | |
| std::string | toJSON () |
| Serialize the entry (header fields + text) as a JSON object string. | |
| std::string | toXML () |
| Serialize the entry as an XML fragment. | |
Public Attributes | |
| uint32 | size |
| uint32 | cid |
| uint64 | time |
| uint32 | source |
| uint8 | subject |
| uint8 | level |
| uint8 | type |
Wire/storage layout of one log record: fixed header immediately followed by the message text.
The struct is a variable-length blob: size covers the header plus the text payload placed directly after the struct in memory, which makes entries trivially copyable across shared memory and sockets.
| const char * cmlabs::LogEntry::getText | ( | uint32 & | len | ) |
| bool cmlabs::LogEntry::setText | ( | char * | text, |
| uint32 | len ) |
Copy len bytes of text into the payload area and update size.
| text | Source text (need not be NUL-terminated). |
| len | Number of bytes to copy. |
Definition at line 247 of file Utils.cpp.
References size.
Referenced by cmlabs::PsyAPI::logPrint(), cmlabs::LogSystem::LogSystemDebug(), and cmlabs::LogSystem::LogSystemPrint().
| std::string cmlabs::LogEntry::toJSON | ( | ) |
Serialize the entry (header fields + text) as a JSON object string.
Definition at line 258 of file Utils.cpp.
References cmlabs::utils::EncodeJSON(), getText(), level, source, cmlabs::utils::StringFormat(), subject, time, and type.
| std::string cmlabs::LogEntry::toXML | ( | ) |
Serialize the entry as an XML fragment.
Definition at line 266 of file Utils.cpp.
References cmlabs::html::EncodeHTML(), getText(), level, source, cmlabs::utils::StringFormat(), subject, time, and type.
| uint32 cmlabs::LogEntry::cid |
Definition at line 230 of file Utils.h.
Referenced by cmlabs::PsyAPI::logPrint(), cmlabs::LogSystem::LogSystemDebug(), and cmlabs::LogSystem::LogSystemPrint().
| uint8 cmlabs::LogEntry::level |
Definition at line 234 of file Utils.h.
Referenced by cmlabs::PsyAPI::logPrint(), cmlabs::LogSystem::LogSystemDebug(), cmlabs::LogSystem::LogSystemPrint(), toJSON(), and toXML().
| uint32 cmlabs::LogEntry::size |
Definition at line 229 of file Utils.h.
Referenced by getText(), cmlabs::PsySpace::logEntry(), cmlabs::PsyAPI::logPrint(), cmlabs::LogSystem::LogSystemDebug(), cmlabs::LogSystem::LogSystemPrint(), and setText().
| uint32 cmlabs::LogEntry::source |
Definition at line 232 of file Utils.h.
Referenced by cmlabs::PsyAPI::logPrint(), cmlabs::LogSystem::LogSystemDebug(), cmlabs::LogSystem::LogSystemPrint(), toJSON(), and toXML().
| uint8 cmlabs::LogEntry::subject |
Definition at line 233 of file Utils.h.
Referenced by cmlabs::PsyAPI::logPrint(), cmlabs::LogSystem::LogSystemDebug(), cmlabs::LogSystem::LogSystemPrint(), toJSON(), and toXML().
| uint64 cmlabs::LogEntry::time |
Definition at line 231 of file Utils.h.
Referenced by cmlabs::PsyAPI::logPrint(), cmlabs::LogSystem::LogSystemDebug(), cmlabs::LogSystem::LogSystemPrint(), toJSON(), and toXML().
| uint8 cmlabs::LogEntry::type |
Definition at line 235 of file Utils.h.
Referenced by cmlabs::PsyAPI::logPrint(), cmlabs::LogSystem::LogSystemDebug(), cmlabs::LogSystem::LogSystemPrint(), toJSON(), and toXML().