mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-21 08:15:28 +03:00
Fixed some project fragmentation that came from efforts to go portable
This commit is contained in:
parent
7d48e20aea
commit
d4c75e3974
33
MediaBrowser.Common/Logging/StreamLogger.cs
Normal file
33
MediaBrowser.Common/Logging/StreamLogger.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace MediaBrowser.Common.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a Logger that can write to any Stream
|
||||
/// </summary>
|
||||
public class StreamLogger : BaseLogger
|
||||
{
|
||||
private Stream Stream { get; set; }
|
||||
|
||||
public StreamLogger(Stream stream)
|
||||
: base()
|
||||
{
|
||||
Stream = stream;
|
||||
}
|
||||
|
||||
protected override void LogEntry(LogRow row)
|
||||
{
|
||||
byte[] bytes = new UTF8Encoding().GetBytes(row.ToString() + Environment.NewLine);
|
||||
Stream.Write(bytes, 0, bytes.Length);
|
||||
Stream.Flush();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
Stream.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user