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); }
private void LeaveContext() { Queue.Enqueue(new LogEvent { Type = LogType.LeaveContext, Text = null }); LogUpdated?.Invoke(); }
void ILogger.LogLine(string message) { Queue.Enqueue(new LogEvent { Type = LogType.LogLine, Text = message }); LogUpdated?.Invoke(); }
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; }
private static void RiseLogUpdateEvent(Message message) { LogUpdated?.Invoke(null, new LogUpdatedEventArgs { NewMessage = message }); }
private void UpdateLogAndLimit() { if (currentLines >= MAX_LINES) { Clear(); } LogUpdated?.Invoke(logBuilder.ToString()); }
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 }" }); }
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 { } }
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; } }
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); }
public static void OnLogUpdated(object sender, EventArgs e) { LogUpdated?.Invoke(sender, e); }
protected void Log(string text) { Logs.Add(text); LogUpdated?.Invoke(this, text); }
protected virtual void OnLogUpdated(string newline) { LogUpdated?.Invoke(newline); }
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); }
protected void OnLogUpdated(string?message, LogLevel level) { LogUpdated?.Invoke(this, new LogEventArgs(message, level)); }