You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
700 B
33 lines
700 B
using System;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace MediaBrowser.Logging
|
|
{
|
|
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();
|
|
}
|
|
}
|
|
}
|