// WARNING: Make sure this it the only method in this class, since // the method is not accessed by name. See below, call to // GetMethods. // This logs the actual events public void LoggerBase(Object[] objects) { if (_eventLog.InvokeRequired) { _eventLog.Invoke(new LoggerBaseHandler(LoggerBase), new object[] { objects }); } else { LoggerListViewItem li = new LoggerListViewItem(_objectEvent._eventInfo.Name); // Skip two frames and get the source information if available li._stackTrace = new StackTrace(2, true); li._objects = objects; li.Tag = _objectEvent; lock (_eventLog) { if (TraceUtil.If(this, TraceLevel.Info)) { Trace.Write(_objectEvent.ToString()); } _eventLog.Items.Add(li); _eventLog.EnsureVisible(_eventLog.Items.Count - 1); // Get correct incarnation number int incNo = TraceIncarnation(); // Build the event parameter string StringBuilder dataStr = new StringBuilder(); for (int i = 0; i < objects.Length; i++) { if (TraceUtil.If(this, TraceLevel.Info)) { Trace.Write(", " + objects[i]); } if (i > 0) { dataStr.Append(", "); } if (objects[i] != null) { // Using object.ToString seems to hang so use the type // name instead. //dataStr.Append(objects[i].ToString()); dataStr.Append(objects[i].GetType().FullName); } } TraceUtil.WriteLineInfo(this, ""); li.SubItems.Add(dataStr.ToString()); li.SubItems.Add(incNo.ToString()); li.SubItems.Add(DateTime.Now.ToString("HH:mm:ss.ff")); } } }