using System.IO;
using Microsoft.Practices.EnterpriseLibrary.SemanticLogging;
using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;

namespace Valg.EVA.Skanning.Diagnostics
{
    public class FlatFileEventTextFormatter : IEventTextFormatter
    {
        public void WriteEvent(EventEntry eventEntry, TextWriter writer)
        {
            var formattedTimestamp = eventEntry.Timestamp.ToLocalTime().ToString("yyyyMMdd-HH:mm:ss.fff");
            var message = eventEntry.FormattedMessage;
            
            writer.WriteLine($"{formattedTimestamp}: {eventEntry.Schema.Level}: {message}");
            writer.WriteLine($"EventId: {eventEntry.EventId}, ProcessId: {eventEntry.ProcessId}, ThreadId: {eventEntry.ThreadId} ");
        }
    }
}
