using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;
using FBPLib.Properties;

namespace FBPLib
{

    internal class Logger
    {
        /* Drastically modified from David Bennett's version */
        /* *
        * Copyright 2007, 2008, J. Paul Morrison.  At your option, you may copy, 
        * distribute, or make derivative works under the terms of the Clarified Artistic License, 
        * based on the Everything Development Company's Artistic License.  A document describing 
        * this License may be found at http://www.jpaulmorrison.com/fbp/artistic2.htm. 
        * THERE IS NO WARRANTY; USE THIS PRODUCT AT YOUR OWN RISK.
        * */

        static bool _tracing;

        internal string Prefix
        {
            get
            {
                return "Tracing: ";
            }
        }

        internal Logger()
        {
            Settings s = Settings.Default;
            _tracing = s.Tracing;  // get value from Properties for FBPLib
        }

        internal void Trace(string msg)
        {
            if (_tracing)
            {
                System.Diagnostics.Trace.WriteLine(Prefix + msg);
                System.Diagnostics.Trace.Flush();
            }
        }


        internal void Trace(string format, params object[] args)
        {
            Trace(String.Format(format, args));
        }

    }
}
