IKVM11
11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
FormattedDiagnosticHandler.cs
Go to the documentation of this file.
1
using
System
;
2
3
using
IKVM.CoreLib.Diagnostics
;
4
5
namespace
IKVM.Tools.Core.Diagnostics
6
{
7
11
class
FormattedDiagnosticHandler
: DiagnosticEventHandler, IDisposable
12
{
13
14
readonly
string
_spec;
15
readonly
DiagnosticFormatterProvider
_formatters;
16
readonly
IDiagnosticFormatter
_formatter;
17
23
public
FormattedDiagnosticHandler
(
string
spec,
DiagnosticFormatterProvider
formatters)
24
{
25
_spec = spec ??
throw
new
ArgumentNullException(nameof(spec));
26
_formatters = formatters ??
throw
new
ArgumentNullException(nameof(formatters));
27
_formatter = _formatters.GetFormatter(spec) ??
throw
new
InvalidOperationException(
"Cannot find formatter for specification."
);
28
}
29
31
public
override
bool
IsEnabled
(
Diagnostic
diagnostic)
32
{
33
return
true
;
34
}
35
37
public
override
void
Report
(in
DiagnosticEvent
@event)
38
{
39
if
(
IsEnabled
(@event.Diagnostic))
40
_formatter.Write(@event);
41
}
42
43
public
virtual
void
Dispose
()
44
{
45
if
(_formatter is IDisposable disposable)
46
disposable.Dispose();
47
}
48
49
}
50
51
}
IKVM.CoreLib.Diagnostics.Diagnostic
Definition
Diagnostic.g.cs:10
IKVM.Tools.Core.Diagnostics.DiagnosticFormatterProvider
Provides the capability to look up diagnostic channels.
Definition
DiagnosticFormatterProvider.cs:12
IKVM.Tools.Core.Diagnostics.FormattedDiagnosticHandler
IDiagnosticHandler implementation that outputs based on a format specification.
Definition
FormattedDiagnosticHandler.cs:12
IKVM.Tools.Core.Diagnostics.FormattedDiagnosticHandler.Report
override void Report(in DiagnosticEvent @event)
Definition
FormattedDiagnosticHandler.cs:37
IKVM.Tools.Core.Diagnostics.FormattedDiagnosticHandler.FormattedDiagnosticHandler
FormattedDiagnosticHandler(string spec, DiagnosticFormatterProvider formatters)
Initializes a new instance.
Definition
FormattedDiagnosticHandler.cs:23
IKVM.Tools.Core.Diagnostics.FormattedDiagnosticHandler.IsEnabled
override bool IsEnabled(Diagnostic diagnostic)
Returns true if the specified Diagnostic is enabled.
Definition
FormattedDiagnosticHandler.cs:31
IKVM.Tools.Core.Diagnostics.FormattedDiagnosticHandler.Dispose
virtual void Dispose()
Definition
FormattedDiagnosticHandler.cs:43
IKVM.Tools.Core.Diagnostics.IDiagnosticFormatter
Definition
IDiagnosticFormatter.cs:10
IKVM.CoreLib.Diagnostics
Definition
Diagnostic.cs:4
IKVM.Tools.Core.Diagnostics
Definition
AsyncDiagnosticChannelWriter.cs:8
System
Definition
HexConverter.cs:9
IKVM.CoreLib.Diagnostics.DiagnosticEvent
Definition
DiagnosticEvent.g.cs:9
src
IKVM.Tools.Core
Diagnostics
FormattedDiagnosticHandler.cs
Generated by
1.12.0