blob: 410394aa2da398a1ad134d087c52506c4b0e3b60 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
using System.IO;
using Utf8Json;
namespace Ryujinx.Common.Logging
{
public class JsonLogTarget : ILogTarget
{
private Stream _stream;
private bool _leaveOpen;
public JsonLogTarget(Stream stream)
{
_stream = stream;
}
public JsonLogTarget(Stream stream, bool leaveOpen)
{
_stream = stream;
_leaveOpen = leaveOpen;
}
public void Log(object sender, LogEventArgs e)
{
JsonSerializer.Serialize(_stream, e);
}
public void Dispose()
{
if (!_leaveOpen)
{
_stream.Dispose();
}
}
}
}
|