HDK
|
#include <UT_UniversalLogInMemorySink.h>
Public Member Functions | |
UT_UniversalLogInMemorySink () | |
~UT_UniversalLogInMemorySink () override | |
exint | activeLogCount () |
exint | allTimeLogCount () |
UT_UniversalLogEntry | allTimeLogEntry (exint all_time_idx) |
void | stealLogEntries (UT_UniversalLogEntryArray &log) |
Public Member Functions inherited from UT_UniversalLogSink | |
UT_UniversalLogSink () | |
virtual | ~UT_UniversalLogSink () |
void | connect (const UT_StringHolder &source_name) |
void | disconnect (const UT_StringHolder &source_name) |
void | disconnectAll () |
void | getConnectedSourceNames (UT_StringArray &source_names) |
void | setFilterEntryCallback (const LogEntryFilterCallback &callback) |
void | log (const UT_UniversalLogEntry &entry) |
Record a message from a log source. More... | |
Protected Member Functions | |
void | doLog (const UT_UniversalLogEntry &entry) override |
This override stores the log messages in memory. More... | |
void | adoptInboundLogEntries () |
Protected Attributes | |
UT_Lock | myInboundDataLock |
UT_UniversalLogEntryArray | myInboundLogEntries |
SYS_AtomicCounter | myInboundTotalLogEntriesSize |
UT_Lock | myDataLock |
UT_UniversalLogEntryArray | myLogEntries |
exint | myTotalLogEntriesSize |
exint | myMaxTotalLogEntriesSize |
SYS_AtomicCounter | myAllTimeLogCount |
A counter that is increased any time a message is added. More... | |
Additional Inherited Members | |
Public Types inherited from UT_UniversalLogSink | |
using | LogEntryFilterCallback = UT_Function< bool(const UT_UniversalLogEntry &)> |
This class is a universal log sync which stores all log entries in memory. A maximum memory use threshold can be set, and excess messages are automatically deleted.
Definition at line 29 of file UT_UniversalLogInMemorySink.h.
UT_UniversalLogInMemorySink::UT_UniversalLogInMemorySink | ( | ) |
|
override |
exint UT_UniversalLogInMemorySink::activeLogCount | ( | ) |
Returns the number of log entries currently in memory. An entry may become "inactive" (i.e. flushed from memory) when this sink reaches its maximum log count, or if someone steals our log entries.
|
protected |
Grab messages from the inbound log entries and add them to the inspectable log entries. This function also enforces the maximum total message size.
NOTE: myDataLock MUST be locked before calling this method.
exint UT_UniversalLogInMemorySink::allTimeLogCount | ( | ) |
Returns the number of log entries we have ever seen. It can be useful to have this monotonically increasing number to look for changes and insulate from the automated (or manual) purging of log entries.
UT_UniversalLogEntry UT_UniversalLogInMemorySink::allTimeLogEntry | ( | exint | all_time_idx | ) |
Returns a copy of the log entry at a specific all-time index. If the index is out of range, or is no longer active, an empty log entry is returned.
|
overrideprotectedvirtual |
This override stores the log messages in memory.
Implements UT_UniversalLogSink.
void UT_UniversalLogInMemorySink::stealLogEntries | ( | UT_UniversalLogEntryArray & | log | ) |
Steals all current log entries into the supplied array. This object will no longer have any record of these log entries after this call.
|
protected |
A counter that is increased any time a message is added.
Definition at line 77 of file UT_UniversalLogInMemorySink.h.
|
protected |
These log entries are the ones that have been collected from the inbound queue. And filtering and sorting happens during this transition.
Definition at line 72 of file UT_UniversalLogInMemorySink.h.
|
protected |
The inbound message queue is where events get logged, but messages on this queue cannot be inspected. We never want the addition of new messages to be blocked by some (potentially slow) inspection of the current set of messages.
Definition at line 66 of file UT_UniversalLogInMemorySink.h.
|
protected |
Definition at line 67 of file UT_UniversalLogInMemorySink.h.
|
protected |
Definition at line 68 of file UT_UniversalLogInMemorySink.h.
|
protected |
Definition at line 73 of file UT_UniversalLogInMemorySink.h.
|
protected |
Definition at line 75 of file UT_UniversalLogInMemorySink.h.
|
protected |
Definition at line 74 of file UT_UniversalLogInMemorySink.h.