/// <summary> /// Initializes an Event Message with the passed parameters /// </summary> internal EventMessage(InstrumentationSource source, Event instrumentationEvent, System.Type type, string method, string message, Exception exception, IErrorHandler errorHandler, EventParameter[] parameters) { try { // Set members. _source = source == null ? string.Empty : source.FullyQualifiedReference; _event = instrumentationEvent == null ? string.Empty : instrumentationEvent.Name; _type = type == null ? string.Empty : type.AssemblyQualifiedName; _method = method ?? string.Empty; _message = message ?? string.Empty; _parameters = parameters; _exception = (exception == null ? null : new ExceptionInfo(exception, errorHandler)); // Store the time in UTC. _time = System.DateTime.UtcNow; if (instrumentationEvent != null) { _details = instrumentationEvent.CreateEventDetails(); } } catch (Exception ex) { // Don't propagate anything outside Instrumentation. If an exception is thrown send a // message to the internal message handler, but only up to a maximum of 10 times. if (_errorCount < Constants.Errors.MaximumErrorsToLog) { _errorCount++; string errorMessage = "The following error occurred while trying to create an EventMessage:" + Environment.NewLine + ex; if (_errorCount >= Constants.Errors.MaximumErrorsToLog) { errorMessage += Environment.NewLine + Environment.NewLine + "No further EventMessage constructor errors will be logged."; } // Use the simplest (private) EventMessage constructor to minimise the chance of // another exception occurring and avoid a loop. InstrumentationManager.GetInternalMessageHandler().HandleEventMessage( new EventMessage(Constants.Events.Warning, typeof(EventMessage).Name, typeof(EventMessage).AssemblyQualifiedName, ".ctor", errorMessage, System.DateTime.UtcNow, new ExceptionInfo(ex, null))); } } }
internal EventMessage(InstrumentationSource source, Event instrumentationEvent, System.Type type, string method, Exception exception, IErrorHandler errorHandler, EventParameter[] parameters) : this(source, instrumentationEvent, type, method, null, exception, errorHandler, parameters) { }
internal EventMessage(InstrumentationSource source, Event instrumentationEvent, System.Type type, string method, string message) : this(source, instrumentationEvent, type, method, message, null, null) { }
internal EventMessage(InstrumentationSource source, Event instrumentationEvent, System.Type type, string method, string message, Exception exception, IErrorHandler errorHandler) : this(source, instrumentationEvent, type, method, message, exception, errorHandler, null) { }
internal EventMessage(InstrumentationSource source, Event instrumentationEvent, System.Type type) : this(source, instrumentationEvent, type, null, (string)null, null, null) { }