npm.io
1.1.0 • Published 3 years ago

@automata-network/debug-js-browser

Licence
ISC
Version
1.1.0
Deps
0
Size
21 kB
Vulns
0
Weekly
0
Stars
1

DebugJs

A front-end logs collection tool.

Install Client

npm i @automata-network/debug-js-browser -S

Use Client

const debugJs = new DebugJs({
  appName: "example",
  collectorUrl: "http://localhost:9000/collect",
  logLevel: LogLevel.Info,
  requestInterval: 5000,
});

debugJs.setUid("johnny");

Install Server SDK

npm i @automata-network/debug-js-server -S

Use Client

const { listen } = require("@automata-network/debug-js-server");

const { app, router } = listen({
  onReceiveLogs: (logs) => {
    console.log(logs);
  },
});

Change Port, Path, Cors And Rate Limit Settings

We are using the @koa/cors and koa-ratelimit, read their document for more informations.

const { listen } = require("@automata-network/debug-js-server");

const { app, router } = listen({
  path: "/collect",
  port: 9000,
  corsOptions: {},
  rateLimitOptions: {},
  onReceiveLogs: (logs) => {
    console.log(logs);
  },
});