Radarr/NzbDrone.Host/Owin/NlogTextWriter.cs

40 lines
834 B
C#
Raw Normal View History

using System.IO;
using System.Text;
using NLog;
2013-08-31 01:42:30 +00:00
using NzbDrone.Common.Instrumentation;
namespace NzbDrone.Host.Owin
{
public class NlogTextWriter : TextWriter
{
2013-09-11 06:33:47 +00:00
private readonly Logger _logger = NzbDroneLogger.GetLogger();
public override Encoding Encoding
{
get
{
return Encoding.Default;
}
}
2013-09-11 06:33:47 +00:00
public override void Write(char[] buffer, int index, int count)
{
2013-09-11 06:33:47 +00:00
Write(buffer);
}
public override void Write(char[] buffer)
{
2013-09-11 06:33:47 +00:00
Write(new string(buffer));
}
public override void Write(string value)
{
2013-09-11 06:33:47 +00:00
_logger.Trace(value);
}
2013-09-11 06:33:47 +00:00
public override void Write(char value)
{
2013-09-11 06:33:47 +00:00
_logger.Trace(value);
}
}
}