From fb58ddce18cb99e4aeb1f7eb7604e4a65fa293f3 Mon Sep 17 00:00:00 2001 From: Simonas Karuzas Date: Wed, 17 Jun 2020 15:19:18 +0300 Subject: [PATCH] feat: Debug agent.execute --- packages/daf-core/src/agent.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/daf-core/src/agent.ts b/packages/daf-core/src/agent.ts index 7fddb1b66..8a3738e06 100644 --- a/packages/daf-core/src/agent.ts +++ b/packages/daf-core/src/agent.ts @@ -1,4 +1,5 @@ import { IAgentBase, TMethodMap, IAgentPlugin } from './types' +import Debug from 'debug' export class Agent implements IAgentBase { readonly methods: TMethodMap = {} @@ -30,7 +31,10 @@ export class Agent implements IAgentBase { } async execute

(method: string, args: P): Promise { + Debug('daf:agent:' + method)('%o', args) if (!this.methods[method]) throw Error('Method not available: ' + method) - return this.methods[method](args, { ...this.context, agent: this }) + const result = await this.methods[method](args, { ...this.context, agent: this }) + Debug('daf:agent:' + method + ':result')('%o', result) + return result } }