Example #1
0
 public void LogMessage(string message)
 {
     message = $"[{string.Format("{0:T}", DateTime.Now)}] {message}";
     Debug.WriteLine(message);
     AppLogs = message + Environment.NewLine + AppLogs;
     LogUpdated?.Invoke(this, message);
 }
Example #2
0
 private void LeaveContext()
 {
     Queue.Enqueue(new LogEvent {
         Type = LogType.LeaveContext, Text = null
     });
     LogUpdated?.Invoke();
 }
Example #3
0
 void ILogger.LogLine(string message)
 {
     Queue.Enqueue(new LogEvent {
         Type = LogType.LogLine, Text = message
     });
     LogUpdated?.Invoke();
 }
Example #4
0
        protected virtual void LogWatcherTimerElapsedCallback(object sender, ElapsedEventArgs e)
        {
            if (!IsSolutionOpen())
            {
                return;
            }

            var logFileStatus = GetLogFileStatus();

            // Log file has been deleted.
            if (logFileStatus == null && _previousLogFileStatus != null)
            {
                LogUpdated?.Invoke(this, new LogChangedEventArgs
                {
                    LogFileStatus = new LogFileStatus
                    {
                        Exists         = false,
                        LastUpdatedUtc = DateTime.UtcNow,
                        HasContent     = false,
                        Path           = _previousLogFileStatus.Path
                    }
                });
            }
            // Log file has been added or changed.
            else if (_previousLogFileStatus == null && logFileStatus != null ||
                     logFileStatus != null && !logFileStatus.Equals(_previousLogFileStatus))
            {
                LogUpdated?.Invoke(this, new LogChangedEventArgs {
                    LogFileStatus = logFileStatus
                });
            }

            _previousLogFileStatus = logFileStatus;
        }
Example #5
0
 private static void RiseLogUpdateEvent(Message message)
 {
     LogUpdated?.Invoke(null, new LogUpdatedEventArgs
     {
         NewMessage = message
     });
 }
Example #6
0
 private void UpdateLogAndLimit()
 {
     if (currentLines >= MAX_LINES)
     {
         Clear();
     }
     LogUpdated?.Invoke(logBuilder.ToString());
 }
Example #7
0
 IDisposable ILogger.Context(string section)
 {
     Queue.Enqueue(new LogEvent {
         Type = LogType.EnterContext, Text = section
     });
     LogUpdated?.Invoke();
     return(new Context(this));
 }
        public void HandleLogUpdated(LogUpdated e)
        {
            var storageNode = e.StorageNode;
            var log         = e.Log;

            m_replicas[storageNode.Id] = true;
            lock (m_messages)
                m_messages.Add(new Message <LogUpdated>()
                {
                    Id = Id, Event = e, Value = $"storage node: { storageNode.Id }, log: { log }"
                });
        }
Example #9
0
 private static void Write(string message)
 {
     try
     {
         var str = "[" + DateTime.Now.ToString("hh:mm:ss.fff") + "] " + message;
         _TextWriter.WriteLine(str);
         LogUpdated?.Invoke(null, str);
         if (WriteToFileEnabled)
         {
             WriteToFile(str);
         }
     }
     catch { }
 }
Example #10
0
        private void LogWatcherTimerElapsedCallback(object sender, ElapsedEventArgs e)
        {
            if (!IsSolutionOpen())
            {
                return;
            }

            var logFileStatus = GetLogFileStatus();

            if (!logFileStatus.Equals(_previousLogFileStatus))
            {
                LogUpdated?.Invoke(this, new LogChangedEventArgs {
                    LogFileStatus = logFileStatus
                });

                _previousLogFileStatus = logFileStatus;
            }
        }
Example #11
0
        public void Write(LoggerLevel level, string log_text)
        {
            var    currentTime    = DateTime.Now.ToString("HH:mm:ss");
            string converted_text = string.Format("[{0} | {1}] {2}\n", DateTime.Now.ToString("HH:mm:ss"), levelMap[level], log_text);

            text.Append(converted_text);

            if (writer != null)
            {
                writer.Write(converted_text);
                writer.Flush();
            }

            var item = new LogItem();

            item.Level     = level;
            item.Text      = log_text;
            item.Timestamp = currentTime;

            LogUpdated?.Invoke(item);
        }
Example #12
0
 public static void OnLogUpdated(object sender, EventArgs e)
 {
     LogUpdated?.Invoke(sender, e);
 }
Example #13
0
 protected void Log(string text)
 {
     Logs.Add(text);
     LogUpdated?.Invoke(this, text);
 }
Example #14
0
 protected virtual void OnLogUpdated(string newline)
 {
     LogUpdated?.Invoke(newline);
 }
Example #15
0
 protected virtual void OnLogUpdated(HOHEvent e)
 {
     LogUpdated?.Invoke(this, e);
 }
 public void LogUpdated(LogUpdated e)
 {
     RuntimeHost.InvokeMonitor(Id, e);
 }
 public void HandleLogUpdated(LogUpdated e)
 {
     Receiver.HandleLogUpdated(e);
 }
Example #18
0
 protected void OnLogUpdated(string?message, LogLevel level)
 {
     LogUpdated?.Invoke(this, new LogEventArgs(message, level));
 }