public void LogEvent(object sender, LogEventArgs eventArgs) { LogEvents.Add(eventArgs); Kon.ForegroundColor = eventArgs.Level.GetConsoleColor(); ConsoleDirectWrite(eventArgs.ToStringLine()); Kon.ForegroundColor = ConsoleColor.Gray; }
public void LogEvent(object sender, LogEventArgs eventArgs) { LogEvents.Add(eventArgs); ConsoleManager.SetConsoleColor(eventArgs.Level.GetConsoleColor()); ConsoleDirectWrite(eventArgs.ToStringLine()); ConsoleManager.SetConsoleColor(ConsoleColor.Gray); }
public void Add(LogEvent logEvent) { if (logEvent == null) { return; } LogEvents.Add(logEvent); }
/// <inheritdoc /> public void Write(LogLevel level, Func <LogEvent> producer) { var logEvent = producer(); LogEvents = LogEvents.Add(new Tuple <LogLevel, LogEvent>(level, logEvent)); if (WriteToConsole) { ConsoleLog.Write(level, ConsoleLog.ToText(level, logEvent)); } }
public void LogEvent(object sender, LogEventArgs eventArgs) { LogEvents.Add(eventArgs); string log = $"[{eventArgs.Level,-7}:{((ILogSource)sender).SourceName,10}] {eventArgs.Data}\r\n"; LogBuilder.Append(log); Kon.ForegroundColor = eventArgs.Level.GetConsoleColor(); ConsoleDirectWrite(log); Kon.ForegroundColor = ConsoleColor.Gray; }
internal void ConfigureVendorFlag() { IsBulkVendor = Vendor.IsBulkVendor; if (IsBulkVendor) { LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.VendorIsBulk)); } else { LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.VendorIsNotBulk)); } }
private void AddLogEvents(string message) { if (Dispatcher.CheckAccess()) { LogEvents.Add(message); var item = LogEventListView.Items[LogEventListView.Items.Count - 1]; LogEventListView.ScrollIntoView(item); } else { Dispatcher.BeginInvoke((Action <string>)AddLogEvents, DispatcherPriority.Normal, message); } }
public void LogEvent(object sender, LogEventArgs eventArgs) { if ((eventArgs.Level & ConfigConsoleDisplayedLevel.Value) == 0) { return; } LogEvents.Add(eventArgs); ConsoleManager.SetConsoleColor(eventArgs.Level.GetConsoleColor()); ConsoleDirectWrite(eventArgs.ToStringLine()); ConsoleManager.SetConsoleColor(ConsoleColor.Gray); }
internal void PrepareForHashLookUps() { Dictionary <string, string> hashLookUpDict = new Dictionary <string, string>(); foreach (Prefill prefill in Invitation.Prefills) { if (prefill.Input_Hash != null) { if (!hashLookUpDict.ContainsKey(prefill.Input_Hash)) { hashLookUpDict.Add(prefill.Input_Hash, prefill.Input); } } } QueueData.CommonIdentifier = Invitation.Target; if (IsEmailDelivery.Value) { if (hashLookUpDict.TryGetValue(QueueData.EmailId, out string emailId)) { QueueData.EmailId = emailId; } } else { if (hashLookUpDict.TryGetValue(QueueData.MobileNumber, out string mobileNumber)) { QueueData.MobileNumber = mobileNumber; } } Dictionary <string, string> unhashedMappedValues = new Dictionary <string, string>(); foreach (KeyValuePair <string, string> keyValuePair in QueueData.MappedValue) { if (!string.IsNullOrEmpty(keyValuePair.Value)) { if (hashLookUpDict.TryGetValue(keyValuePair.Value, out string unhashedValue)) { unhashedMappedValues.Add(keyValuePair.Key, unhashedValue); } else { unhashedMappedValues.Add(keyValuePair.Key, keyValuePair.Value); } } } QueueData.MappedValue = unhashedMappedValues; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.HashLookUpDictConfigured)); }
/// <summary> /// Create a new log entry with type, time and message /// </summary> /// <param name="logEvent">log event</param> public void LogEvent(LogEvent logEvent) { if (logEvent.LogType != LogTypes.IMAGE || (logEvent.LogType == LogTypes.IMAGE && EnableImageLogs)) { LogEvents.Add(logEvent); if (AutoScrollToLastLogEntry) { ScrollToLastLogEvent(); } if (IsSearchEnabled) { HighlightAllListViewItems(true); } } }
internal void ConfigureVendor() { DispatchChannel dispatchChannel = Resources.GetInstance().AccountConfiguration.DispatchChannels?.Find(x => x.DispatchId == QueueData.DispatchId); if (dispatchChannel == default) { IsVendorConfigured = false; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.DispatchChannelNotFound)); InvitationLogEvents.Add(Utils.CreateInvitationLogEvent(EventAction.DispatchUnsuccessful, IsEmailDelivery.Value ? EventChannel.Email : EventChannel.SMS, QueueData, IRDLM.DispatchChannelNotFound)); } else { string vendorName = null; if (IsEmailDelivery.Value) { vendorName = dispatchChannel?.ChannelDetails?.Email?.IsValid ?? false ? dispatchChannel.ChannelDetails.Email.Vendorname : null; } else { vendorName = dispatchChannel?.ChannelDetails?.Sms?.IsValid ?? false ? dispatchChannel.ChannelDetails.Sms.Vendorname : null; } if (vendorName == null) { IsVendorConfigured = false; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.DispatchVendorNameMissing)); InvitationLogEvents.Add(Utils.CreateInvitationLogEvent(EventAction.DispatchUnsuccessful, IsEmailDelivery.Value ? EventChannel.Email : EventChannel.SMS, QueueData, IRDLM.DispatchVendorNameMissing)); } else { LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.DispatchVendorNamePresent(vendorName))); Vendor = Resources.GetInstance().AccountConfiguration.Vendors?.Find(x => string.Equals(x.VendorName, vendorName, StringComparison.InvariantCultureIgnoreCase)); if (Vendor == null) { IsVendorConfigured = false; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.DispatchVendorConfigMissing)); InvitationLogEvents.Add(Utils.CreateInvitationLogEvent(EventAction.DispatchUnsuccessful, IsEmailDelivery.Value ? EventChannel.Email : EventChannel.SMS, QueueData, IRDLM.DispatchVendorConfigMissing)); } else { IsVendorConfigured = true; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.DispatchVendorConfigPresent(Vendor))); } } } }
internal async Task ConfigureUserData() { Invitation = await Resources.GetInstance().LogEventCollection.Find(x => x.TokenId == QueueData.TokenId && x.BatchId == QueueData.BatchId && x.DispatchId == QueueData.DispatchId).FirstOrDefaultAsync(); if (Invitation == default) { IsUserDataLogEventConfigured = false; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.UserDataNotFound)); } else { IsUserDataLogEventConfigured = true; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.UserDataFound(Invitation.Id))); } }
public void CreateEvent(CommandersLogEvent partiallyCompleteCommandersLogEventEvent) // when we create from the webserver { // set it to UTC everywhere or nowhere -> pay attention to the different timezones // if you wan't to concatenate ED-time and local pc time //var now =DateTime.UtcNow; var now = DateTime.Now; var newGuid = Guid.NewGuid().ToString(); ClearLogEventFields(); _callingForm.dtpLogEventDate.Value = now; _callingForm.tbLogEventID.Text = newGuid; partiallyCompleteCommandersLogEventEvent.EventID = Guid.NewGuid().ToString(); partiallyCompleteCommandersLogEventEvent.EventDate = now; LogEvents.Add(partiallyCompleteCommandersLogEventEvent); }
internal void Validate() { bool isTokenIdPresent = !string.IsNullOrWhiteSpace(QueueData.TokenId); bool isBatchIdPresent = !string.IsNullOrWhiteSpace(QueueData.BatchId); bool isDispatchIdPresent = !string.IsNullOrWhiteSpace(QueueData.DispatchId); if (isTokenIdPresent && isBatchIdPresent && isDispatchIdPresent) { IsProcessable = true; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.Validated(QueueData.AdditionalURLParameter))); } else { IsProcessable = false; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.Invalidated)); } }
public String CreateEvent(string eventType, string station, string system, string cargo, string cargoAction, int cargoVolume, string notes, DateTime eventDate) { String newEventID = Guid.NewGuid().ToString(); LogEvents.Add(new CommandersLogEvent { EventType = eventType, Station = station, System = system, Cargo = cargo, CargoAction = cargoAction, CargoVolume = cargoVolume, Notes = notes, EventDate = eventDate, EventID = newEventID }); UpdateCommandersLogListView(); return(newEventID); }
public string CreateEvent() { String newEventID = Guid.NewGuid().ToString(); _callingForm.tbLogEventID.Text = newEventID; LogEvents.Add(new CommandersLogEvent { EventType = _callingForm.cbLogEventType.Text, Station = _callingForm.cbLogStationName.Text, System = _callingForm.cbLogSystemName.Text, Cargo = _callingForm.cbLogCargoName.Text, CargoAction = _callingForm.cbCargoModifier.Text, CargoVolume = int.Parse(_callingForm.cbLogQuantity.Text), Notes = _callingForm.tbLogNotes.Text, EventDate = _callingForm.dtpLogEventDate.Value, EventID = newEventID }); return(newEventID); }
internal void ConfigureChannel() { if (!string.IsNullOrWhiteSpace(QueueData.EmailId) && !string.IsNullOrWhiteSpace(QueueData.MobileNumber)) { IsEmailDelivery = null; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.ChannelNotConfigured1)); } else if (!string.IsNullOrWhiteSpace(QueueData.EmailId)) { IsEmailDelivery = true; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.EmailChannelConfigured)); } else if (!string.IsNullOrEmpty(QueueData.MobileNumber)) { IsEmailDelivery = false; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.SmsChannelConfigured)); } else { IsEmailDelivery = null; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.ChannelNotConfigured2)); } }
private void LogNewEvent(LogEvent newEvent) { if (!dispatcher.CheckAccess()) { dispatcher.BeginInvoke( new Action( delegate { LogNewEvent(newEvent); } )); } else { if (newEvent.LogSeverity != LogEvent.Severity.Trace) { LogEvents.Add(newEvent); } ////Add to nLog //switch (newEvent.LogSeverity) //{ // case LogEvent.Severity.Error: // logger.Error(newEvent.Message); // break; // case LogEvent.Severity.Info: // logger.Info(newEvent.Message); // break; // case LogEvent.Severity.Warning: // logger.Warn(newEvent.Message); // break; // case LogEvent.Severity.Trace: // logger.Trace(newEvent.Message); // break; //} } }
public void AddEvent(EventLogEntry e) { Application.Current.Dispatcher.InvokeAsync(() => LogEvents.Add(e)); }
public MessagePayload(QueueData queueData) { QueueData = queueData; LogEvents.Add(Utils.CreateLogEvent(QueueData, IRDLM.Dequeued)); }