protected override void Track(TrackingRecord record, TimeSpan timeout) { Console.ForegroundColor = ConsoleColor.Cyan; if (record is ActivityScheduledRecord) { ActivityScheduledRecord actSchedule = record as ActivityScheduledRecord; Console.WriteLine("Name: {0}, Scheduled", actSchedule.Child.Name); } else if (record is ActivityStateRecord) { ActivityStateRecord actState = record as ActivityStateRecord; Console.WriteLine("Name: {0}, {1}", actState.Activity.Name, actState.State); } else if (record is WorkflowInstanceRecord) { WorkflowInstanceRecord wInstanceRecord = record as WorkflowInstanceRecord; Console.WriteLine("WorkFlow, {0}", wInstanceRecord.State); } else { Console.WriteLine(record.ToString()); } Console.ResetColor(); }
protected override void Track(TrackingRecord record, TimeSpan timeout) { Console.WriteLine(); IDictionary <string, string> annotations = record.Annotations; Console.WriteLine(record.ToString()); }
protected override void Track(TrackingRecord record, TimeSpan timeout) { var sb = new StringBuilder(record.ToString()); //foreach (var annotation in record.Annotations) // sb.AppendLine(annotation.Key + " " + annotation.Value); Debug.WriteLine(sb.ToString()); }
protected override void Track(TrackingRecord record, TimeSpan timeout) { _fileName = $@"C:\logs\{record.InstanceId}.tracking"; using (var sw = File.AppendText(_fileName)) { sw.WriteLine("-----------Tracking Started-----------"); sw.WriteLine(record.ToString()); sw.WriteLine("-----------Trakcing End---------------"); } }
protected override void Track(TrackingRecord record, TimeSpan timeout) { // get the tracking path string fileName = IOHelper.GetTrackingFilePath(record.InstanceId); // create a writer and open the file using (StreamWriter tw = File.AppendText(fileName)) { // write a line of text to the file tw.WriteLine(record.ToString()); } }
protected override void Track(TrackingRecord record, TimeSpan timeout) { //if (record.Level != TraceLevel.Error) return; _fileName = @"d:\" + record.InstanceId + ".txt"; using (var sw = File.AppendText(_fileName)) { var json = JsonConvert.SerializeObject(record); var obj = JsonConvert.DeserializeObject <ErrorRecordDataStructure>(json); //if (obj.FaultSource == null) return; //var str = obj.EventTime.ToString(CultureInfo.CurrentCulture) + "--" + obj.ActivityDefinitionId + "--" + obj.FaultSource.Name.ToString() + "--" + // obj.UnhandledException.Message; sw.WriteLine(record.ToString()); } }
/// <summary> /// Constructs a tracking message /// </summary> /// <param name="trackingRecord">The message to track</param> public CustomTrackingMessage(TrackingRecord trackingRecord) { RecordType = trackingRecord.GetType().Name; InstanceId = trackingRecord.InstanceId.ToString(); RecordNumber = trackingRecord.RecordNumber; EventTime = trackingRecord.EventTime; Content = trackingRecord.ToString().Replace("<null>", "null"); if (trackingRecord is WorkflowInstanceRecord) { ActivityDefinitionId = ((WorkflowInstanceRecord)trackingRecord).ActivityDefinitionId; State = ((WorkflowInstanceRecord)trackingRecord).State; } if (trackingRecord is ActivityScheduledRecord) { Activity = new CustomActivityMessage(((ActivityScheduledRecord)trackingRecord).Activity); ChildActivity = new CustomActivityMessage(((ActivityScheduledRecord)trackingRecord).Child); } if (trackingRecord is ActivityStateRecord) { Activity = new CustomActivityMessage(((ActivityStateRecord)trackingRecord).Activity); State = ((ActivityStateRecord)trackingRecord).State; Variables = ((ActivityStateRecord)trackingRecord).Variables.ToDictionary(kvp => kvp.Key, kvp => kvp.Value == null ? null : kvp.Value.ToString()); Arguments = ((ActivityStateRecord)trackingRecord).Arguments.ToDictionary(kvp => kvp.Key, kvp => kvp.Value == null ? null : kvp.Value.ToString()); } if (trackingRecord is CustomTrackingRecord) { Activity = new CustomActivityMessage(((CustomTrackingRecord)trackingRecord).Activity); Name = ((CustomTrackingRecord)trackingRecord).Name; Data = string.Join(", ", ((CustomTrackingRecord)trackingRecord).Data.Select(kvp => string.Format("{0} = {1}", kvp.Key, kvp.Value))); } if (trackingRecord is WorkflowInstanceUnhandledExceptionRecord) { Activity = new CustomActivityMessage(((WorkflowInstanceUnhandledExceptionRecord)trackingRecord).FaultSource); Data = ((WorkflowInstanceUnhandledExceptionRecord)trackingRecord).UnhandledException.ToString(); } }
protected override void Track(TrackingRecord record, TimeSpan timeout) { try { TestTraceManager.OptionalLogTrace("[InMemoryTrackingParticipant]Track()::InMemory tracking participant = {0} ; Tracking record type = {1} ; Record Details = {2}", this.Name, record.GetType(), record.ToString()); TestTraceManager.OptionalLogTrace("[InMemoryTrackingParticipant]TestTraceManager.IsDefaultTrackingConfiguration = {0}", TestTraceManager.IsDefaultTrackingConfiguration.ToString()); bool IsPushDataToTraceManager = true; ActualTrace _trace = this.GetActualTrackingData(record.InstanceId); if (record is WorkflowInstanceRecord) { TrackWorkflowInstanceRecord(record as WorkflowInstanceRecord, _trace); } else if (record is ActivityStateRecord) { IsPushDataToTraceManager = TrackActivityStateRecord(record as ActivityStateRecord, _trace); } else if (record is ActivityScheduledRecord) { TrackActivityScheduledRecord(record as ActivityScheduledRecord, _trace); } else if (record is BookmarkResumptionRecord) { TrackBookmarkResumptionRecord(record as BookmarkResumptionRecord, _trace); } else if (record is CancelRequestedRecord) { TrackCancelRequestedRecord(record as CancelRequestedRecord, _trace); } else if (record is FaultPropagationRecord) { TrackFaultPropagationRecord(record as FaultPropagationRecord, _trace); } if (IsPushDataToTraceManager) { PushDataToTraceManager(record); } } //This exception will be eaten by the product tracking code and not available for review //So the only chance we have to see it is if we log it. catch (Exception e) { //Log.WarnInternal("Exception thrown in Track() method\n" + e.ToString()); throw; } }
protected override Task TrackAsync(TrackingRecord record, TimeSpan timeout) { logger.Info(record.ToString()); return(Task.CompletedTask); }
private static String FormatMessage(TrackingRecord record) { ActivityStateRecord a = record as ActivityStateRecord; return(record.ToString()); }