Beispiel #1
0
        protected virtual void          Dispose(bool aDisposing)
        {
            if (!mDisposed)
            {
                if (aDisposing)
                {
                    Trace.Close();

                    if (mFileTraceListener != null)
                    {
                        mFileTraceListener.Dispose();
                        mFileTraceListener = null;
                    }

                    if (mLogTraceListener != null)
                    {
                        mLogTraceListener.Dispose();
                        mLogTraceListener = null;
                    }

                    disposeLogForm();
                }
                mDisposed = true;
            }
        }
Beispiel #2
0
        private Log(int aInstanceNum)
        {
            string lPath = MiscUtils.AssemblyPath + "\\Log\\";

            if (Directory.Exists(lPath) == false)
            {
                Directory.CreateDirectory(lPath);
            }

            mFileTraceListener = new TextWriterTraceListener(lPath + DateTime.Now.ToString("yyyyMMdd_HHmmss_") + StringUtils.ObjectToString(aInstanceNum) + ".log");
            mLogForm           = new LogForm();
            mLogTraceListener  = new LogTraceListener(mLogForm);

            Trace.Listeners.Clear();
            Trace.Listeners.Add(mFileTraceListener);
            Trace.Listeners.Add(mLogTraceListener);
            Trace.AutoFlush = true;
        }