diff --git a/src/ServiceStack.Logging.EventLog/EventLogger.cs b/src/ServiceStack.Logging.EventLog/EventLogger.cs index ab6617c..4c9c04f 100644 --- a/src/ServiceStack.Logging.EventLog/EventLogger.cs +++ b/src/ServiceStack.Logging.EventLog/EventLogger.cs @@ -20,7 +20,8 @@ public class EventLogger : ILog /// /// Name of the event log. /// The event log source. - public EventLogger(string eventLogName, string eventLogSource) + /// The event message. + public EventLogger(string eventLogName, string eventLogSource, string eventLogMessage = ERROR_MSG) { if (string.IsNullOrEmpty(eventLogName)) { @@ -30,8 +31,13 @@ public EventLogger(string eventLogName, string eventLogSource) { throw new ArgumentNullException("eventLogSource"); } + if (string.IsNullOrEmpty(eventLogMessage)) + { + throw new ArgumentNullException("eventLogMessage"); + } this.eventLogName = eventLogName; this.eventLogSource = eventLogSource; + this.eventLogMessage = eventLogMessage; } public bool IsDebugEnabled { get { return true; } } @@ -75,7 +81,7 @@ private void Write(object message, Exception execption, EventLogEntryType eventL } eventLogger.Source = eventLogName; - eventLogger.WriteEntry(String.Format(ERROR_MSG, eventLogSource, sb), eventLogType); + eventLogger.WriteEntry(String.Format(eventLogMessage, eventLogSource, sb), eventLogType); } ///