Azure / botbuilder-instrumentation

Add extra logging for bot framework
MIT License
23 stars 22 forks source link

Log message.attachments on send #15

Open CristianPQ opened 7 years ago

CristianPQ commented 7 years ago

Right now only the text is being logged on MBFEvent.BotMessage, so, if the the message contains any attachment it's not being logged any data of them. It would be nice at least to know that it has attachments, and some indicator of each one of them.

send: (message, next) => {
    try {
        if (message.type == "message") {
            let item = {
                text: message.text,
                type: message.type
            };
            if(message.attachments) {
                item.attachments = item.attachments.map((val) => (val.contentType))
            }
            this.logEvent(message, events_1.default.BotMessage.name, item);
        }
    }
    catch (e) {
    }
    finally {
        next();
    }
}

Something like that would be enough to avoid log to much data.

morsh commented 7 years ago

@CristianPQ - I agree, but it might take some time to add / test this. If you PR it, I'll review it quickly.