Example #1
0
 protected virtual void Log(string rawMessage, LogDetailLevels level)
 {
     if (level != this.m_LogDetailLevel)
     {
         return;
     }
     lock (this.m_LogMessageQueue)
     {
         if (this.m_LogFile != null || this.SfisLog != null)
         {
             this.m_LogMessageQueue.Enqueue(new string[2]
             {
                 rawMessage,
                 DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")
             });
             try
             {
                 this.m_LogMessageThread.RunWorkerAsync();
             }
             catch (InvalidOperationException ex)
             {
             }
         }
     }
 }
Example #2
0
        private void initialize()
        {
            this.m_Encoding                 = Encoding.ASCII;
            this.m_LogDetailLevel           = LogDetailLevels.TestMessage;
            this.m_LogFilePathname          = (string)null;
            this.Connected                  = (SfisConnectionChanged)null;
            this.Disconnected               = (SfisConnectionChanged)null;
            this.Error                      = (SfisConnectionError)null;
            this.SfisLog                    = (soteLib.soteSFIS2.SfisLog)null;
            this.m_LogFile                  = (StreamWriter)null;
            this.m_LogMessageQueue          = new Queue <string[]>();
            this.m_LogMessageThread         = new BackgroundWorker();
            this.m_LogMessageThread.DoWork += new DoWorkEventHandler(this.LogMessageWorker);
            this.m_LogMessageThread.WorkerSupportsCancellation = true;
            if (this.DesignMode || IniFile.FileName == null || !File.Exists(IniFile.FileName))
            {
                return;
            }
            string profile1 = IniFile.GetProfile("SFIS2", "LOGDETAILLEVEL");
            string profile2 = IniFile.GetProfile("SFIS2", "LOGFILEPATHNAME");

            switch (profile1)
            {
            case "NONE":
                this.m_LogDetailLevel = LogDetailLevels.None;
                break;

            case "RAWMESSAGE":
                this.m_LogDetailLevel = LogDetailLevels.RawMessage;
                break;
            }
            if (!string.IsNullOrEmpty(profile2))
            {
                this.m_LogFilePathname = profile2;
            }
        }