private void HandleOutput(string output, ApplicationLogType type) { if (!string.IsNullOrEmpty(output)) { var log = new ApplicationLog { ApplicationLogType = type, LogTime = DateTime.UtcNow, LogText = output }; _standardOutputQueue.Enqueue(log); LogInputOutput(log); if (MessageParser != null) { MessageParser.HandleOutput(output); } } while (_standardOutputQueue.Count > _maxOutputRetained) { _standardOutputQueue.Dequeue(); } }
/// <summary> /// Processes the delete command. /// </summary> void ProcessDeleteCommand(ApplicationLogType type) { LogDto dto = new LogDto(); int totalrecords = 0; if (type == ApplicationLogType.ApplicationLog) { dto = LogManager.GetAppLog("", "", "", DateTime.MinValue, 0, int.MaxValue, ref totalrecords); } else if (type == ApplicationLogType.SystemLog) { dto = LogManager.GetSystemLog("", "", DateTime.MinValue, 0, int.MaxValue, ref totalrecords); } if (dto.ApplicationLog.Rows.Count > 0) { for (int i = 0; i < dto.ApplicationLog.Rows.Count; i++) { dto.ApplicationLog.Rows[i].Delete(); } LogManager.SaveAppLog(dto); } }
private string GetLogFormatted(ApplicationLogType logType, string message, Exception exception = null) { return($"{_totalCount} {DateTime.Now:HH:mm:ss.fff} {logType}: {message} {exception}"); }