IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.CoreLib.Diagnostics.TextDiagnosticFormat Class Reference

Handles writing diagnostic events to text output. More...

Static Public Member Functions

static void Write (int id, DiagnosticLevel level, string message, object?[] args, Exception? exception, DiagnosticLocation location, TextWriter writer)
 Writes the given event data to the specified StringWriter.
 
static async ValueTask WriteAsync (int id, DiagnosticLevel level, string message, object?[] args, Exception? exception, DiagnosticLocation location, TextWriter writer, CancellationToken cancellationToken)
 Writes the given event data to the specified StringWriter.
 
static void Write< TWriter > (int id, DiagnosticLevel level, string message, object?[] args, Exception? exception, DiagnosticLocation location, ref TWriter writer, Encoding? encoding=null)
 Writes the given event data to the specified IBufferWriter<byte>.
 

Detailed Description

Handles writing diagnostic events to text output.

Definition at line 17 of file TextDiagnosticFormat.cs.

Member Function Documentation

◆ Write()

static void IKVM.CoreLib.Diagnostics.TextDiagnosticFormat.Write ( int id,
DiagnosticLevel level,
string message,
object?[] args,
Exception? exception,
DiagnosticLocation location,
TextWriter writer )
static

Writes the given event data to the specified StringWriter.

Parameters
id
level
message
args
exception
location
writer

Definition at line 30 of file TextDiagnosticFormat.cs.

31 {
32 var buffer = MemoryPool<byte>.Shared.Rent(65535);
33
34 try
35 {
36 var wrt = new MemoryBufferWriter<byte>(buffer.Memory);
37 Write(id, level, message, args, exception, location, ref wrt, writer.Encoding);
38 writer.Write(writer.Encoding.GetString(buffer.Memory.Span[..wrt.WrittenCount]));
39 }
40 finally
41 {
42 buffer.Dispose();
43 }
44 }
Implements the IBufferWriter<T> interface around a Memory<T>.
static void Write(int id, DiagnosticLevel level, string message, object?[] args, Exception? exception, DiagnosticLocation location, TextWriter writer)
Writes the given event data to the specified StringWriter.

◆ Write< TWriter >()

static void IKVM.CoreLib.Diagnostics.TextDiagnosticFormat.Write< TWriter > ( int id,
DiagnosticLevel level,
string message,
object?[] args,
Exception? exception,
DiagnosticLocation location,
ref TWriter writer,
Encoding? encoding = null )
static

Writes the given event data to the specified IBufferWriter<byte>.

Template Parameters
TWriter
Parameters
id
level
message
args
exception
location
writer
encoding
Type Constraints
TWriter :IBufferWriter<byte> 

Definition at line 85 of file TextDiagnosticFormat.cs.

86 : IBufferWriter<byte>
87 {
88 var encoder = new EncodingByteBufferWriter<TWriter>(encoding ?? Encoding.UTF8, ref writer);
89 WriteDiagnosticEvent(ref encoder, id, level, message, args, exception, location);
90 }
Provides an interface to write text to a IBufferWriter<byte>.

◆ WriteAsync()

static async ValueTask IKVM.CoreLib.Diagnostics.TextDiagnosticFormat.WriteAsync ( int id,
DiagnosticLevel level,
string message,
object?[] args,
Exception? exception,
DiagnosticLocation location,
TextWriter writer,
CancellationToken cancellationToken )
static

Writes the given event data to the specified StringWriter.

Parameters
id
level
message
args
exception
location
writer
cancellationToken

Definition at line 57 of file TextDiagnosticFormat.cs.

58 {
59 var buffer = MemoryPool<byte>.Shared.Rent(65535);
60
61 try
62 {
63 var wrt = new MemoryBufferWriter<byte>(buffer.Memory);
64 Write(id, level, message, args, exception, location, ref wrt, writer.Encoding);
65 await writer.WriteAsync(writer.Encoding.GetString(buffer.Memory.Span[..wrt.WrittenCount]));
66 }
67 finally
68 {
69 buffer.Dispose();
70 }
71 }

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