using Aitex.Core.RT.Log;

namespace Aitex.Core.RT.Event
{
	internal class EventLogWriter
	{
		public void WriteEvent(EventItem ev)
        {
            if (ev.Description == null)
                return;

            var log = $"{ev.Source} {ev.Description.Replace("'", "''")}";


            switch (ev.Level)
            {
                case EventLevel.Alarm:
                    LOG.Error(log);
                    break;
                case EventLevel.Warning:
                    LOG.Warning(log);
                    break;
                default:
                    LOG.Info(log, isTraceOn: false);
                    break;
            }
		}
	}
}
