Skip to content

WorkloadLoggingFilter

Namespace: Hex1b

Assembly: Hex1b.dll

A workload filter that logs all data flowing through the workload pipeline to a file.

csharp
public sealed class WorkloadLoggingFilter : IHex1bTerminalWorkloadFilter, IAsyncDisposable, IDisposable

Inheritance

ObjectWorkloadLoggingFilter

Implements

Constructors

WorkloadLoggingFilter(string, bool)

Creates a new workload logging filter.

Parameters:

  • filePath (String): Path to the log file.
  • includeHexDump (Boolean): Whether to include hex dumps of raw data.
csharp
public WorkloadLoggingFilter(string filePath, bool includeHexDump = true)

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

csharp
public void Dispose()

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

Returns: ValueTask

A task that represents the asynchronous dispose operation.

csharp
public ValueTask DisposeAsync()

OnFrameCompleteAsync(TimeSpan, CancellationToken)

Called when the workload output channel is drained (no more data immediately available).

Parameters:

Returns: ValueTask

csharp
public ValueTask OnFrameCompleteAsync(TimeSpan elapsed, CancellationToken ct = default)

OnInputAsync(IReadOnlyList<AnsiToken>, TimeSpan, CancellationToken)

Called when input is being sent to the workload.

Parameters:

Returns: ValueTask

csharp
public ValueTask OnInputAsync(IReadOnlyList<AnsiToken> tokens, TimeSpan elapsed, CancellationToken ct = default)

OnOutputAsync(IReadOnlyList<AnsiToken>, TimeSpan, CancellationToken)

Called when output data is read from the workload.

Parameters:

Returns: ValueTask

csharp
public ValueTask OnOutputAsync(IReadOnlyList<AnsiToken> tokens, TimeSpan elapsed, CancellationToken ct = default)

OnResizeAsync(int, int, TimeSpan, CancellationToken)

Called when the terminal is resized.

Parameters:

Returns: ValueTask

csharp
public ValueTask OnResizeAsync(int width, int height, TimeSpan elapsed, CancellationToken ct = default)

OnSessionEndAsync(TimeSpan, CancellationToken)

Called when the terminal session ends.

Parameters:

Returns: ValueTask

csharp
public ValueTask OnSessionEndAsync(TimeSpan elapsed, CancellationToken ct = default)

OnSessionStartAsync(int, int, DateTimeOffset, CancellationToken)

Called when the terminal session starts.

Parameters:

Returns: ValueTask

csharp
public ValueTask OnSessionStartAsync(int width, int height, DateTimeOffset timestamp, CancellationToken ct = default)

Remarks

This filter is useful for debugging terminal issues by capturing: Output FROM the workload with timestampsInput TO the workload with timestampsResize eventsFrame completion signals

The log format includes elapsed time since session start and a hex dump of the raw bytes for detailed analysis.

Examples

csharp
var terminal = Hex1bTerminal.CreateBuilder()
    .WithWorkloadLogging("/tmp/terminal.log")
    .WithProcess("bash")
    .Build();

Released under the MIT License.