Search code examples
c#azurebotframework

Custom debug logging with Microsoft Bot Framework Emulator v4


Is it possible to add custom debug logs to a message with Microsoft Bot Framework Emulator v4 ?

You can view some logging in the inspector: enter image description here

I have tried a solution found here, this is a solution for Bot Framework V3

var reply = activity.CreateReply("test");
string json = @"{
    CustomField1: 'Field one value',
    CustomField2Array: [
        'First Element',
        'Second Element'
        ]
    }";


reply.ChannelData = JObject.Parse(json);
await context.PostAsync(reply);

But this doesn't work for a Dialog in Bot Framework V4


Solution

  • ChannelData can still be set within a Bot Builder V4 dialog and viewed with the V4 Emulator:

     var reply = step.Context.Activity.CreateReply();
    
     string json = @"{
         CustomField1: 'Field one value',
         CustomField2Array: [
             'First Element',
             'Second Element'
                            ]
         }";
    
      reply.ChannelData = JObject.Parse(json);
    

    enter image description here