@automata-network/debug-js-server
Advanced tools
Comparing version 1.1.0 to 1.2.0
# @automata-network/debug-js-server | ||
## 1.2.0 | ||
### Minor Changes | ||
- add log handler | ||
## 1.1.0 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@automata-network/debug-js-server", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "a front-end logs collection tool", | ||
@@ -5,0 +5,0 @@ "private": false, |
module.exports = { | ||
handler: async (ctx) => { | ||
const { body } = ctx.request; | ||
generateHandler: (logReceiver) => { | ||
return async (ctx) => { | ||
const { body } = ctx.request; | ||
const logParsed = formateLog(body); | ||
const logParsed = formateLog(body); | ||
console.log(logParsed); | ||
logReceiver(logParsed); | ||
ctx.type = "json"; | ||
ctx.status = 200; | ||
ctx.type = "json"; | ||
ctx.status = 200; | ||
}; | ||
}, | ||
@@ -12,0 +14,0 @@ }; |
@@ -17,2 +17,3 @@ const Koa = require("koa"); | ||
corsOptions, | ||
onReceiveLogs, | ||
} = options || {}; | ||
@@ -22,3 +23,3 @@ const app = new Koa(); | ||
router.post(path, koaBody(), collect.handler); | ||
router.post(path, koaBody(), collect.generateHandler(onReceiveLogs)); | ||
@@ -25,0 +26,0 @@ app.use( |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2608
66