Vixen
02b45cc4
csharp
public sealed class RemoteSink

Streams the log to the editor's console over the inspector connection: JSON records, one per line, batched, on a thread of the sink's own.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The sink that makes a build running on a phone, a console or another machine debuggable — doc 13's remote inspector reads the log stream from here, and "attach the editor to a running player" is how mobile debugging actually happens.

The logging thread never waits on the network. A record is copied into a bounded ring and the caller returns; a background thread drains it. When the far end is slow, detached, or was never there, the ring overwrites its oldest records and DroppedCount says how many — a remote console showing the most recent thousand lines is useful, and a frame loop blocked on a socket write is not.

Records are JSON rather than the packed UTF-8 form doc 13 wants for the ring, because the far end here is a tool over a wire rather than a byte ring in the same process, and a self-describing line survives the two ends being different versions.

Fields and properties (3)

  • public const int DefaultCapacity

    How many records are held for sending when no capacity is given.

  • public int PendingCount

    How many records are waiting to be sent.

  • public long DroppedCount

    How many records were dropped because the far end could not keep up or was not there. A remote console that does not admit its gaps is worse than one that shows fewer lines.

Methods (4)

  • public RemoteSink(IRemoteLogTransport transport, int capacity = 4096, LogLevel minimumLevel = Information, LogFilter? filter = null)

    Creates a sink streaming to a transport.

  • public bool Flush(TimeSpan timeout)

    Waits for everything logged so far to reach the transport.

  • protected override void Write(LogRecord record)

    Writes one record wherever this sink writes.

  • protected override void Dispose(bool disposing)

    Releases what the sink holds.

Used by (1)

  • SinkTestsVixen.Core.Diagnostics.Tests