/// <summary> /// The send message. /// </summary> /// <param name="eventId">The event id.</param> /// <param name="serialisedMessage">The serialised message.</param> public void SendMessage(EventIdEnum eventId, string serialisedMessage) { var notificationMessage = new NotificationMessage { EventId = EventIdEnum.XmlMessage, // Need to wrap up the message in a string element Message = string.Format(@"<string>{0}</string>", serialisedMessage) }; _messageSender.SendRequestMessage(notificationMessage); }
bool ILogManager.WriteLog(TraceType trace, string message, string context, Exception objEx, EventIdEnum eventId) { return(LogManager.WriteLog(trace, message, context, objEx, eventId)); }
/// <summary> /// Logs the errors to log file. /// </summary> /// <param name="trace">Type of trace.</param> /// <param name="message">User Message to be written.</param> /// <param name="context">The context where the error has occurred.</param> /// <param name="objEx">The exception object.</param> /// <param name="eventId">The EventIdEnum to facilitate reading in log manager.</param> /// <returns>if any error return false else true</returns> public static bool WriteLog(TraceType trace, string message, string context, Exception objEx, EventIdEnum eventId) { bool objWriteLogSuccess = false; try { if (LogManager.IsTraceActive(trace)) { EventLogEntryType objEntryType; switch (trace) { case TraceType.ERROR: objEntryType = EventLogEntryType.Error; break; case TraceType.DEBUG: objEntryType = EventLogEntryType.FailureAudit; break; case TraceType.EXCEPTION: objEntryType = EventLogEntryType.Error; break; case TraceType.INFO: objEntryType = EventLogEntryType.Information; break; case TraceType.WARNING: objEntryType = EventLogEntryType.Warning; break; default: objEntryType = EventLogEntryType.Information; break; } objWriteLogSuccess = WriteEventLog(objEx, context, message, objEntryType, (int)eventId); } } catch { Console.WriteLine("Problem in writing to Log file."); objWriteLogSuccess = false; } return(objWriteLogSuccess); }