HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_UniversalLogInMemorySink Class Reference

#include <UT_UniversalLogInMemorySink.h>

+ Inheritance diagram for UT_UniversalLogInMemorySink:

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 &)>
 

Detailed Description

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.

Constructor & Destructor Documentation

UT_UniversalLogInMemorySink::UT_UniversalLogInMemorySink ( )
UT_UniversalLogInMemorySink::~UT_UniversalLogInMemorySink ( )
override

Member Function Documentation

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.

void UT_UniversalLogInMemorySink::adoptInboundLogEntries ( )
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.

void UT_UniversalLogInMemorySink::doLog ( const UT_UniversalLogEntry entry)
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.

Member Data Documentation

SYS_AtomicCounter UT_UniversalLogInMemorySink::myAllTimeLogCount
protected

A counter that is increased any time a message is added.

Definition at line 77 of file UT_UniversalLogInMemorySink.h.

UT_Lock UT_UniversalLogInMemorySink::myDataLock
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.

UT_Lock UT_UniversalLogInMemorySink::myInboundDataLock
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.

UT_UniversalLogEntryArray UT_UniversalLogInMemorySink::myInboundLogEntries
protected

Definition at line 67 of file UT_UniversalLogInMemorySink.h.

SYS_AtomicCounter UT_UniversalLogInMemorySink::myInboundTotalLogEntriesSize
protected

Definition at line 68 of file UT_UniversalLogInMemorySink.h.

UT_UniversalLogEntryArray UT_UniversalLogInMemorySink::myLogEntries
protected

Definition at line 73 of file UT_UniversalLogInMemorySink.h.

exint UT_UniversalLogInMemorySink::myMaxTotalLogEntriesSize
protected

Definition at line 75 of file UT_UniversalLogInMemorySink.h.

exint UT_UniversalLogInMemorySink::myTotalLogEntriesSize
protected

Definition at line 74 of file UT_UniversalLogInMemorySink.h.


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