private void WriteHeaderDetail(String source, TraceEventType eventType, int id, TraceEventCache eventCache, TraceLog log)
        {
            var sev = (int)eventType;

            if (sev > 255)
            {
                sev = 255;
            }
            if (sev < 0)
            {
                sev = 0;
            }

            log.Component                 = componentName;
            log.Host                      = GetHostHeader();
            log.UrlLocalPath              = GetRequestLocalPath();
            log.EventId                   = ((uint)id);
            log.Type                      = eventType.ToString();
            log.Severity                  = sev;
            log.TimeCreated               = DateTime.UtcNow;
            log.TimeCreatedFormatted      = DateTime.UtcNow.ToString("o");
            log.LocalTimeCreated          = DateTime.Now;
            log.LocalTimeCreatedFormatted = DateTime.Now.ToString("o");
            log.SourceName                = source;
            log.CorrelationActivityId     = eventCache != null?System.Diagnostics.Trace.CorrelationManager.ActivityId.ToString() : Guid.Empty.ToString("B");

            log.MachineName = machineName;
            log.RequestId   = GetRequestId();
            log.Environment = GetEnvironment();

            WriteFooter(eventCache, log);
        }
 private void WriteHeader(String source, TraceEventType eventType, int id, TraceEventCache eventCache, DateTime eventTimeStamp, TraceLog log)
 {
     WriteHeaderDetail(source, eventType, id, eventCache, log);
 }
 private void WriteData(object data, TraceLog log)
 {
     log.Data.Add(data.ToString());
 }
 private void WriteHeader(String source, TraceEventType eventType, int id, TraceEventCache eventCache, Guid relatedActivityId, DateTime eventTimeStamp, TraceLog log)
 {
     WriteHeaderDetail(source, eventType, id, eventCache, log);
     log.RelatedActivityId = relatedActivityId.ToString("B");
 }