[+] void IBasicSinkRB::PreviewRingBuffer
This commit is contained in:
parent
1735fa9c6c
commit
9092f9268c
@ -21,5 +21,7 @@ namespace Aurora::Logging
|
|||||||
* This method does not clear the ring buffer
|
* This method does not clear the ring buffer
|
||||||
*/
|
*/
|
||||||
virtual AuList<ConsoleMessage> Export() = 0;
|
virtual AuList<ConsoleMessage> Export() = 0;
|
||||||
|
|
||||||
|
virtual void PreviewRingBuffer(AuConsumer<AuPair<const AuList<ConsoleMessage>&, AuUInt32>> callback) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -113,6 +113,17 @@ namespace Aurora::Logging::Sinks
|
|||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RingBufferSink::PreviewRingBuffer(AuConsumer<AuPair<const AuList<ConsoleMessage> &, AuUInt32>> callback)
|
||||||
|
{
|
||||||
|
if (!callback)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AU_LOCK_GUARD(this->logMutex_);
|
||||||
|
callback(AuMakePair(AuConstReference(this->logBuffer_), this->index_));
|
||||||
|
}
|
||||||
|
|
||||||
void RingBufferSink::OnFlush()
|
void RingBufferSink::OnFlush()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@ namespace Aurora::Logging::Sinks
|
|||||||
void SaveToPath(const AuString &path, bool binary = false) override;
|
void SaveToPath(const AuString &path, bool binary = false) override;
|
||||||
AuList<ConsoleMessage> Export() override;
|
AuList<ConsoleMessage> Export() override;
|
||||||
|
|
||||||
|
void PreviewRingBuffer(AuConsumer<AuPair<const AuList<ConsoleMessage> &, AuUInt32>> callback) override;
|
||||||
|
|
||||||
bool TryAddMsg(AuUInt8 level, const ConsoleMessage &msg, bool &drop);
|
bool TryAddMsg(AuUInt8 level, const ConsoleMessage &msg, bool &drop);
|
||||||
private:
|
private:
|
||||||
AuUInt32 maxCount_;
|
AuUInt32 maxCount_;
|
||||||
|
Loading…
Reference in New Issue
Block a user