@ubio/logger
Advanced tools
@@ -5,27 +5,2 @@ 'use strict'; | ||
| function processContext({ request, headers, status }) { | ||
| if (request) { | ||
| return { | ||
| requestMethod: request.method, | ||
| requestUrl: request.url, | ||
| status, | ||
| referrer: headers && headers.referer, | ||
| userAgent: headers && headers['user-agent'], | ||
| remoteIp: request.ip | ||
| }; | ||
| } | ||
| } | ||
| function processUser({ authorized, authorizedModel }) { | ||
| if (!authorized) { | ||
| return null; | ||
| } | ||
| if (typeof authorizedModel === 'object' && authorizedModel.modelName) { | ||
| authorizedModel = authorizedModel.modelName; | ||
| } | ||
| return `${authorizedModel}:${authorized.id}${authorized.name ? ` (${authorized.name})` : ''}`; | ||
| } | ||
| class StackDriverTransform extends Transform { | ||
@@ -40,3 +15,3 @@ constructor(options = {}) { | ||
| const { error, ctx } = chunk.context || {}; | ||
| const error = chunk.error; | ||
@@ -54,8 +29,2 @@ if (error) { | ||
| if (ctx) { | ||
| chunk.context.user = processUser(ctx); | ||
| chunk.httpRequest = processContext(ctx); | ||
| delete chunk.context.ctx; | ||
| } | ||
| callback(null, chunk); | ||
@@ -62,0 +31,0 @@ } |
+1
-1
| { | ||
| "name": "@ubio/logger", | ||
| "version": "1.2.0", | ||
| "version": "1.3.0", | ||
| "description": "Logger component for UB", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
-100%7432
-10.65%172
-13.13%