﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace DBUpdater.Core
{
    public class TraceController
    {
        public TraceController(ConnStringInfo connStringInfo)
        {
            Trace.Listeners.Clear();
            var tl = TextWriterTraceListenerFactory.GetTextWriterListener(connStringInfo);
            Trace.Listeners.Add(tl);
        }

        public void Cleanup()
        {
            var listeners = Trace.Listeners;
            foreach (TraceListener listener in listeners)
            {
                listener.Close();
                listener.Dispose();
            }
        }

    }
}
