Socket
Book a DemoInstallSign in
Socket

botbuilder-calling-logging

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botbuilder-calling-logging

Logging middleware for botbuilder. Uses DocumentDb and Azure Blob to persist bot events.

3.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Installation

npm install --save botbuilder-calling-logging

Peer dependencies

npm install --save documentdb azure-storage botbuilder-calling

Usage

TypeScript

import { BotCallLogger } from 'botbuilder-calling-logging';
import { BlobService } from 'azure-storage';
import { DocumentClient } from 'documentdb';
import { UniversalBot } from 'botbuilder-calling';

// your chat bot
const callbot = new UniversalBot(/* params */);

// create logger
const logger = new BotCallLogger(new DocumentClient(/* params */), {
  documents: {
    databaseName: 'logs1', 
    collectionName: 'bot1',
  },
  blobs: { // wav files are stored here
    blobService: new BlobService(/* params */),
    options: { containerName: 'botcalls', }
  },
});

// logs are queued internally to prevent blocking the middleware pipeline
//   so logging errors are not visible to the bot
//   instead, catch logging IO errors in this event handler
logger.events.on('error', console.error);

// attach logger to the chatbot
callbot.use(logger);

Error handling

Any errors encountered by the DocumentClient or BlobService are not returned through the bot middleware service. In order to capture these errors, listen to the logger's error event.

logger.events.on('error', console.error);

Advanced

DocumentDB Partitioning

For large-scale DocumentDB collections (RU > 10K), the recommended partitionKey is /address/conversation/id

Log format

Logs are stored in DocumentDB as JSON documents. Any binary attachments (images, speech) are stored as attachments in DocumentDb, as well as on Azure Blob Storage, if it is configured.

Extending the data store

To persist logs or blobs in arbitrary stores, implement your own DocumentWriter and BlobWriter classes (see the botbuilder-logging package). Then write your own bot middleware that calls BotLogWriter.enqueue. See class BotCallLogger for sample implementation.

FAQs

Package last updated on 12 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.