From d100f0eab0fa25c861cbae2ced60afc5dfa8da6b Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Thu, 19 Jun 2025 01:54:33 +0300 Subject: Job Failed Event Impl. --- .../Tango.PPC.Common/EventLogging/DefaultEventLogger.cs | 14 +++++++++----- .../PPC/Tango.PPC.Common/EventLogging/IEventLogger.cs | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs index 4e00474f4..59c56ed42 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs @@ -155,18 +155,17 @@ namespace Tango.PPC.Common.EventLogging /// The instance containing the event data. private void MachineOperator_PrintingFailed(object sender, PrintingFailedEventArgs e) { - String eventInfo = String.Empty; + EventTypes? relatedEventType = null; if (e.Exception is Transport.ResponseErrorException responseError) { if (responseError.Container.EventCode > 0) { - EventTypes evType = (EventTypes)responseError.Container.EventCode; - eventInfo = "\n#" + responseError.Container.EventCode + " " + evType.ToDescription(); + relatedEventType = (EventTypes)responseError.Container.EventCode; } } - Log(EventTypes.JOB_FAILED, e.Exception.Message + eventInfo); + Log(EventTypes.JOB_FAILED, e.Exception.Message, relatedEventType); } /// @@ -330,7 +329,7 @@ namespace Tango.PPC.Common.EventLogging /// /// Type of the event. /// The message. - public void Log(EventTypes eventType, string message) + public void Log(EventTypes eventType, string message, EventTypes? relatedEventType = null) { Init(); @@ -340,6 +339,11 @@ namespace Tango.PPC.Common.EventLogging machineEvent.EventType = _eventTypesGuids[eventType]; machineEvent.EventTypeGuid = machineEvent.EventType.Guid; + if (relatedEventType != null) + { + machineEvent.RelatedEventType = _eventTypesGuids[relatedEventType.Value]; + } + Log(machineEvent); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/IEventLogger.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/IEventLogger.cs index 81cce927d..a39f36cc1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/IEventLogger.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/IEventLogger.cs @@ -36,7 +36,7 @@ namespace Tango.PPC.Common.EventLogging /// /// Type of the event. /// The message. - void Log(EventTypes eventType, String message); + void Log(EventTypes eventType, String message, EventTypes? relatedEventType = null); /// /// Logs the specified hardware event. -- cgit v1.3.1