diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/DefaultEventLogger.cs | 14 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/EventLogging/IEventLogger.cs | 2 |
2 files changed, 10 insertions, 6 deletions
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 /// <param name="e">The <see cref="PrintingFailedEventArgs"/> instance containing the event data.</param> 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); } /// <summary> @@ -330,7 +329,7 @@ namespace Tango.PPC.Common.EventLogging /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="message">The message.</param> - 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 /// </summary> /// <param name="eventType">Type of the event.</param> /// <param name="message">The message.</param> - void Log(EventTypes eventType, String message); + void Log(EventTypes eventType, String message, EventTypes? relatedEventType = null); /// <summary> /// Logs the specified hardware event. |
