Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logging #224

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions src/XrmMockupShared/TracingService.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
using Microsoft.Xrm.Sdk;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DG.Tools.XrmMockup {
internal class TracingService : ITracingService {
public void Trace(string format, params object[] args) {
try
{
Console.WriteLine(format, args);
}
catch
{
Console.WriteLine(format);
}
internal class TracingService : ITracingService
{
static TracingService()
{
//Enable mstest output to test results by using Trace.
System.Diagnostics.Trace.Listeners.Add(new ConsoleTraceListener());
}
public void Trace(string format, params object[] args)
{
try
{
System.Diagnostics.Trace.WriteLine(string.Format(format, args));
}
catch
{
System.Diagnostics.Trace.WriteLine(format);
}
}
}
}
4 changes: 2 additions & 2 deletions src/XrmMockupWorkflow/WorkflowConstructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static WorkflowTree Parse(Entity workflow, Dictionary<string, CodeActivit
{
if (workflow == null || workflow.LogicalName != LogicalNames.Workflow)
{
throw new WorkflowException($"Entity had logicalname '{LogicalNames.Workflow}' instead of workflow");
throw new WorkflowException($"Entity had logicalname '{workflow.LogicalName}' instead of {LogicalNames.Workflow}");
}
var parsed = Parser.Parse(workflow.GetAttributeValue<string>("xaml"));
var triggerFields = new HashSet<string>();
Expand All @@ -46,7 +46,7 @@ public static WorkflowTree Parse(Entity workflow, Dictionary<string, CodeActivit
workflow.GetOptionSetValue<workflow_stage>("createstage"), workflow.GetOptionSetValue<workflow_stage>("updatestage"),
workflow.GetOptionSetValue<workflow_stage>("deletestage"), workflow.GetOptionSetValue<Workflow_Mode>("mode"),
workflow.GetAttributeValue<EntityReference>("ownerid").Id, workflow.GetAttributeValue<string>("primaryentity"), codeActivites,
input, output);
input, output, workflow.GetAttributeValue<string>("name"));
}

private static WorkflowArgument ConvertToArgument(Property p)
Expand Down
Loading