Class RealmLoggingDbCtx
- Namespace
- Arc4u.Diagnostics.Serilog.Sinks.RealmDb
- Assembly
- Arc4u.Diagnostics.Serilog.Sinks.RealmDb.dll
An ILogStore that reads the log messages persisted in a Realm database, the most recent first.
public class RealmLoggingDbCtx : ILogStore
- Inheritance
-
RealmLoggingDbCtx
- Implements
- Inherited Members
Remarks
A Realm instance can only be used on the thread that opened it, so each call opens its own instance and closes it before returning. The store can therefore be registered as a singleton and called from any thread, including under a synchronization context that is not bound to one thread (Blazor Server, xUnit).
Constructors
RealmLoggingDbCtx(RealmConfiguration)
Initializes a new instance of the RealmLoggingDbCtx class.
public RealmLoggingDbCtx(RealmConfiguration config)
Parameters
configRealmConfigurationThe configuration of the Realm database.
Methods
GetLogs(string, int, int)
Gets a page of the messages ordered by descending timestamp. skip entries are skipped first;
then at most take entries are examined and, when a criteria is given, only those whose text contains it (case-insensitive) are returned.
public List<LogMessage> GetLogs(string criteria, int skip, int take)
Parameters
criteriastringText that the message must contain. When empty, no filter is applied.
skipintThe number of messages to skip.
takeintThe maximum number of messages to examine.
Returns
- List<LogMessage>
The matching log messages.
RemoveAll()
Removes all the stored log messages.
public void RemoveAll()